Refactor Registry to use Dependency Injection. 

This pull request also contains factories for Registry and Keychain to keep this useable until we have some sort of DIC.