Added endgame and replay functionality