Cleaning up javascript and product template