Deals with the rearranging items when insert.