lots of stuff in functions.js