Added digit checking and Token struct.
Minor cleanup.