restructure js