Tidy up formatting & optimize main.js & plugins.js