refactored re-seq-with-pos to be more elegant, possibly slightly slower