clean MainWidget code