insert sort code