now builds value tree and reference tree