reorganized JS