Allow sorting the entry list.

Code needs to be cleaned probably, but this appears to work.