more refactoring and moving stuff