Updates to the findandInsertFunction