Primarily added unit tests. Fixes #190.