Modified code and added js-beautify.