Restructure js