More tests and a lot of refactoring