Restructuring the Javascripts