major js recgactorings