Updated functions.js to be less intrusive