Added unit test cases and descriptive comments.