First part of getting this updateHEAD/setAsHEAD mess right