added comments and tests