Added proper window raise and window state flags