renamed aRef to aREF
started to support nested input documents