Changed sorting method