This duplicates **a lot** of code from `createTimeseries`. See if you can refactor to share more code.