Smart sort implemented for the first time