Add basic unit test, complete API