added a test case and some commenting