Add unit tests

Closes #42