Added function to copy ref from head to worker.
Gets index.