implements new mechanism to attach expansion metadata to trees