Add ReplaceSeries and refactor the CreateSeries function into smaller steps

Done: Uncommented and made correct.