Fix some warnings.
Fix indentation.
Refactor MainWindow, it uses UIs now.