Refactoring main window centering