Fixed all the tests, simplified the API