make comments and stuff more elegant and fix a possible bug