converted the public API to use pimpl and opaque pointers, removed memory copy in result path, better management of dynamic memory allocation