change cluster js logic