small refactorings of generated javascripts