implemented substitution