code polish && shift class to outside mainwindow