better sequence fn
add replace fn