Implemented ordering for groups