API polish.
Clean up tests and type checker.