second ref-set added, minor fixes