unit tests, API cleanup