implemented end of game basics and fixed associated bugs