Initial group sorting and table header sorting

Clicking on columns sorts each of the groups separately by that column.
Always stays from 1-5 with 1 on top.