restructures javascript files