checkforwinner refactor