refactoring, sorting