Added substitution for terms.
Added substitution for terms.