Added external sorting algorithm