Implementing the Registry query function