Added some API methods, fixed unit tests