added an update_potentials function