Improved tests, cleaned up the API some.