Refactor editor launch code for flexibility