code cleaning and test