extract the UG-specific code out of the whole blob into its own Singleton object.
finished the refactoring of the ug key-char map; other minor clean-ups.