added comments and fixed typo