substitute one function for another