Added scoping and user functions
Added scoping and user functions