Cleaning up API, updating unit tests