Refactoring a few querying methods