Working version without win detection.