rewriting all javascript