add comments and fix issue