adding a refresh function