Further cleaning and mor modularization