code cleaning and formatting