Lots of refactoring to Application and Window