implemented and tested end game functionality