Implemented extract_digits