added winner check code.