Changed sorting mechanism