Implemented insertion sort