Refactor functional code out of EditorModel