Further cleanup, and test coverage