moved some script to js