adds group sorting to top action.