Add sorting to groups and options