refresh logic