refactoring more stuff