refactoring, big tables sorting