updated to use a thread for refreshing cached docs