Added impl. of insert helper function