theoretical implementaiton of Addnodes and AddReferences. Not tested at all!