added getDigit function