added comments and a test