Implemented insertion sort algorithm.