Break dependencies on global registries.

This improves testability.