Refactored code to allow the addition of a state machine mechanism
for tracking the game state.