new tests and refactoring that I forgot to check in!