Can we move this logic to another file?
I'm thinking if this should be in the main editor file.