Refine insert sort method. Fixing issue 5