cleaning up initial version, adding api wrapper and tests