added js logic