Refactored query for latest update