Rename some main window functions and variables.
Fix bugs related to previous commit.