Add ReplaceSeries and refactor the CreateSeries function into smaller steps

Might want to mention that "canonically ordered" means alphabetically sorted.