Added unit tests, cleaned up code