modified refresh logic