Some javascripts housekeeping