Revamped end states by adding endGame() function

Consolidation of code, increased clarity