Fixed various syntax issues.
"use strict" is put into each funciton instead of the top of the file so it does not affect other js files that are included later.