added saving and restoring of main UI window, and scrollbars when needed