documentation improvement
fixed typo
fixed typos
udpated to use defaultdict to save some dict lookups
additional error detection and associated tests
updated invalid value handling and added corresponding test
fixed strange indentation
fixed bad type for -b; added short option names for required parameters