added automatic connection refresh