removed nested sort check