changed refresh function