general code cleaning and quality improvement