replaced outdated juqery call with local function