Extracted function isHex