Improve code reducing the nested level and added jsHint

Just type on terminal:
```
$ npm install -g jshint
$ jshint src/*
```