Improvements to GUID generation code

Change-Id: I8a8c9dfcd33afc0b59398ebfd302e2aa290342bd