working on the insertion function