refactoring: code duplication on reading from registry eliminated