[nim] Refactored all methods that aid in controlling series out of index.js into series_controls.js