Simplify the api.
Cleanup and bugfixes.