Changed to using insertion sort