implemented the TODO in Substitution