Added more documentation to functions.js