Fixes syntax errors and cleans file so jshint is usable.