Cleaning and code layout