Refactor editor into Editor class