Unit test branch

Added some unit tests.