move some js parts to the external js module