Much more refactoring of edit and editor, moved most stuff out to where
it belongs.