UI fixes

- MainWindow.xaml: reformatted and cleaned code
- MainWindow.xaml.cs: event handlers should know work properly, reformatted and cleaned code