Uncommented sections of the gamePlay function