Optimized placement of JS for front-end performance