insert-replace fn added