Basic function variable replacement done for one example, need to clean
up and try on more complicated examples