Solved insertion sort