Got the sorting of records fixed