code cleaning and comments