implemented overlooked sorting requirement