A simpler way to handle the query for notifications