Clean up Javascript

Make jshint pass, couple of tiny js fixes/improvements.