Extracting registry tree. Refactoring