Fixing callback function name so it is not undefined.
Cleaning up code with JSHint.