changes to insert func