Large refactoring to get rid of the registry notion.