Cleaning things up a bit more, adding tests