#255 - Refactor sort groups