Copied all into MainWindow, needs cleanup, keeping it as legacy