Optimistion de code MainWindow

Code improvement MainWindow #16