Common name fix

Here are fixes for the common name problem (mostly) an a bit of code cleanup along the way.  Tried to break up the commits to make things a bit easier to follow.