Added end-game functionality