Add unit tests

Closes #1