Adding tests

Adds unit tests to cover existing functionality.  Any feedback would be appreciated.