rewrite mainwindow to use helper