Finished up functions.js for real this time