complete functions.js