Refactoring no hmQuery