refactoring and shit