Factor out some common code.
Added some code to enable the user to configure unit selection in a more detailed fashion. you can now select either metric or imperial, or both, and even set which one of those should be displayed first.