658 add sorting to org page

I think this function has outlived it's complexity, can we move all the sub-functions to their own functions and call them, i.e. all the values for the keys in the `cond`.