move refresh function to outside of http GET