Safe Formulas in the General Theory of Stable Models