Added code from old exitgame branch to start with.