updated func.js to fix functionality