major JS restructuring