Reorganizing javascripts