refactored out test reference tree checking