Js restructure