major js reorganization, redid debug page