Added game ending logic