added comments and prevented a possible bug