need to add function as a local function but too sleepy