added explicit return from local function