Reorganize functions to avoid undef functions.
Add more jshint parameters. re #96