Fix jshint warning for function inside a loop
Add grunt and fix some jshint warning
Fix two small errors in database