added checking for winning conditions