What the hack is this? The method initOnMaster is executed only on the master - not on any slave (slaveIndex is probably set to 0 as default value on the master). The masterState is NOT propagated in any magic way to the other nodes.
This probably works, because fillWordsArray really initializes the words and then the serialized stage is sent over network to the other nodes. However, all the stuff with masterState and checking slaveIndex is really confusing.
And by the way, waiting for 5 * number of slaves seconds if we can read the words from master state? What?