add logic for game ending