Begin of refactor notepadCtrl