Made get_sub_elements much nicer, and I expect few problems with it now
Fixed a bug in xref attribution