JSHint fixes

Merge after #4 and #5. The script is the same, but with changes to pass JSHint's tests.