Checks for ties as well as game-over

Includes refactor