Changed sorting algorithm of widgets