completed functions.js