more refactoring yay