Implements basic gamestate functionality.