Try generalizing code to any number of workers