Fix some JSLint errors.
Define functions in a function and use the strict mode.
Fix a missing semicolon.