Improved internal ULDB layering.

While vetting the code, trying to find a cause for a SIGSEGV. Doesn't
seem to have made a difference.