Better digit parsing method