parse uuid from string with or without dashes
code cleanups and improved parse-uuid