move a lot of js code to js file