Tidied up hex string -> int conversion.