Updated the query loop with a navigation.