Added swapping two fns within sort fn