working on an insertion function