added group dynamic sorting