Added most functions to final.js