added builtins for user defined functions, fixed scope issues with macros