Updated the editor with switch logic