implement logic of refreshing