changed clerk to cyclic barrier and implemented in run