restructure js files