Respect the window style mask the window is initialised with, minor logic and other changes