Refactor query maps