added separate Engine class to clean up MainWindow