SelectQuery refactoring.