Adding more tests, refactoring a little bit