keep track of worker id outside of loop