ParseHex refactoring