refactored the code a bit to get rid of some lines in the check-win function