Sort method which now works in both directions.