Clean up, adds some missing test coverage