Quick fix

The substitution rule is now working. Generalization has been made more convenient.