Modifying function context

Error that was left out when local function was removed