Refactor and test OptionRegistry.