cleaned and optimized js and templates