implementing worker index, and a way to access it from loop