refactored editor code & fixed browser bugs