private void handleReferenceInput(Map<Input, InstanceInput> universe, int depth,
Input curInput, Input origin) {
ReferenceInput ri = (ReferenceInput) curInput;
List<ModuleInstance> parentInstances = ri.reference().module().instances();
for(ModuleInstance mi : parentInstances){
if(mi.withinUniverse(universe) ){
Map<Input, InstanceInput> nextUniverse = new LinkedHashMap<Input, InstanceInput>(universe);
nextUniverse.putAll(mi.universe());
InstanceOutput refInstanceOutput = mi.output(((ReferenceInput) curInput).reference().name());
Object nextValue = refInstanceOutput.value();
if(!ri.multiValue()){
nextUniverse = new LinkedHashMap<Input, InstanceInput>(nextUniverse);
nextUniverse.put(origin, new InstanceInput(this, origin, nextValue, refInstanceOutput));
instantiateInputRec( nextUniverse, depth+1);