Updated the sort handling to be consistent.