Add the register name maps as we go rather than at the end.  Without this, using the mapping inside the library is problematic.