move refresh function to query