Fix broken tests, clean up APIs and add comments