Moved edit window to new function