Refactored the editor to allow for nesting.