Created qsort and compare for sorting records of every block