js: Fixed accidental global variables
js: Removed unused variables
Merge pull request #31 from Turbo87/js-fixes

JS fixes