update with js logic