Refactored query.