Completely refactors with some thought put in. Adds the REGISTRIES hash which maps registries to keywords.