refactoring and fix improperly assigned editor instance on line read