Code cleanup and initial framework on end of game