Avoid relative imports.

Incorporate feedback from @dhermes.
Encapsulate factory registry as a singleton object.

Use its methods, rather than free functions.