remove dead code
fix sorting of results

I guess no one cares about sorting since this has been broken for so
long...