VarFun refactoring

Now functions are more concise.