Refactored for speed using dictionary for unitnames and List of units
Unittests repaired
amend forgot some pattern refactoring and a change in the way the dictionary is built.