Updated hexToDec function