disentangled the ref update method a bit