Complete unit tests. Closes #142.