Switching headers changes sort direction

If you switch between two different headers and switch back, the sort direction is changed. I felt this was a bit weird hence this patch. Instead, the order is only updated if the header is clicked multiple times in succession. If you switch headers, the last known direction is preserved (or otherwise default).

I'm open to discussion for this.