Improve addJs function