refactor editor code and make it work with oc7