Looks for first defined rule for last state and disregards spaces
Removed unnecesary is_digit method