Add unit tests

Closes #42
I'm :+1: on merging this to add tests, then opening a new PR for the refactorings.