Resolve JSHint warnings and clean up code.