Adds test cases and fixes comments