implements insertiong sort method