Removed the useless definition of local functions
They were only defined to call them in another local function that was
defined immediately afterwars. There is no benefit with this, so these
local functions were incorporated into the local function doing the
actual action.