add JS Beautifier https://github.com/einars/js-beautify
minor refactoring