fixed the javascripts better