modularization and cleanup...