some fixing and js-beautify the result