How to change function behaviors and argument values on the fly