Collapsed winning function.
Comments tidied up slightly