Added unit tests and fixed doc comments