Did a lot of refactoring to dialogs and buttons.