abstract UUID parsing code to an individual function; patch from Anthony