Refactoring: grouping, results processing and other.