Proper window detection