Moved MAIN() to main window