Added some test cases and comments.