I think these things are better than your things

Added some tests, a bit of refactoring