changed sorting a bit