Added unit test and more API