Added unit tests to all functionality