moved editor window to it's own function