Partial revert: unfactorize javascript