Refactored the HexToString class