Refactor query methods