Added sorting of grouping by heirarchy