Fixed window position when activating new window
Refactored window creation