Replaced FunctionProxy by ValueFunction and lots of template magic.