progress
main refactoring and cleanup