slightly refactor .js* files