Updated js logic.