added logic for vertical and diagonal wins. simplified logic in general.