Rewrote high-level API to support a handle-based interface