More cleaning and optimization