changed the refresh logic