Fixed payloads, sorted tokens, major speed improvements
diff --git a/t/xip/constituency.xml b/t/xip/constituency.xml
new file mode 100644
index 0000000..d36678f
--- /dev/null
+++ b/t/xip/constituency.xml
@@ -0,0 +1,534 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-model href="span.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
+
+<layer xmlns="http://ids-mannheim.de/ns/KorAP" docid="GOE_AGA.03828" version="KorAP-0.4">
+   <spanList>
+      <span id="s1_n1" from="0" to="254">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ROOT</f>
+         </fs>
+         <rel label="dominates" target="s1_n2"/>
+      </span>
+      <span id="s1_n2" from="0" to="254">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">S</f>
+         </fs>
+         <rel label="dominates" target="s1_n3"/>
+         <rel label="dominates" uri="morpho.xml#s1_n35"/>
+         <rel label="dominates" target="s1_n37"/>
+         <rel label="dominates" uri="morpho.xml#s1_n43"/>
+         <rel label="dominates" target="s1_n45"/>
+         <rel label="dominates" uri="morpho.xml#s1_n130"/>
+      </span>
+      <span id="s1_n3" from="0" to="58">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">PP</f>
+         </fs>
+         <rel label="dominates" target="s1_n4"/>
+      </span>
+      <span id="s1_n4" from="0" to="58">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">S</f>
+         </fs>
+         <rel label="dominates" target="s1_n5"/>
+         <rel label="dominates" target="s1_n23"/>
+      </span>
+      <span id="s1_n5" from="0" to="50">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">PP</f>
+         </fs>
+         <rel label="dominates" target="s1_n6"/>
+      </span>
+      <span id="s1_n6" from="0" to="50">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">S</f>
+         </fs>
+         <rel label="dominates" target="s1_n7"/>
+         <rel label="dominates" target="s1_n13"/>
+      </span>
+      <span id="s1_n7" from="0" to="17">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" target="s1_n8"/>
+      </span>
+      <span id="s1_n8" from="0" to="17">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CNP</f>
+         </fs>
+         <rel label="dominates" target="s1_n9"/>
+      </span>
+      <span id="s1_n9" from="0" to="17">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" target="s1_n10"/>
+      </span>
+      <span id="s1_n10" from="0" to="17">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">AP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n11"/>
+      </span>
+      <span id="s1_n11" from="0" to="17">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ADJA</f>
+         </fs>
+      </span>
+      <span id="s1_n13" from="18" to="50">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" target="s1_n14"/>
+      </span>
+      <span id="s1_n14" from="18" to="50">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CNP</f>
+         </fs>
+         <rel label="dominates" target="s1_n15"/>
+      </span>
+      <span id="s1_n15" from="18" to="50">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" target="s1_n16"/>
+         <rel label="dominates" uri="morpho.xml#s1_n21"/>
+      </span>
+      <span id="s1_n16" from="18" to="48">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">AP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n17"/>
+         <rel label="dominates" uri="morpho.xml#s1_n19"/>
+      </span>
+      <span id="s1_n17" from="18" to="30">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ADJA</f>
+         </fs>
+      </span>
+      <span id="s1_n19" from="31" to="48">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NN</f>
+         </fs>
+      </span>
+      <span id="s1_n21" from="49" to="50">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">TRUNC</f>
+         </fs>
+      </span>
+      <span id="s1_n23" from="50" to="58">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP-SB</f>
+         </fs>
+         <rel label="dominates" target="s1_n24"/>
+      </span>
+      <span id="s1_n24" from="50" to="58">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CS</f>
+         </fs>
+         <rel label="dominates" target="s1_n25"/>
+      </span>
+      <span id="s1_n25" from="50" to="58">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">S</f>
+         </fs>
+         <rel label="dominates" target="s1_n26"/>
+         <rel label="dominates" target="s1_n32"/>
+      </span>
+      <span id="s1_n26" from="50" to="52">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CNP-SB</f>
+         </fs>
+         <rel label="dominates" target="s1_n27"/>
+      </span>
+      <span id="s1_n27" from="50" to="52">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n28"/>
+         <rel label="dominates" uri="morpho.xml#s1_n30"/>
+      </span>
+      <span id="s1_n28" from="50" to="51">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CARD</f>
+         </fs>
+      </span>
+      <span id="s1_n30" from="51" to="52">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">TRUNC</f>
+         </fs>
+      </span>
+      <span id="s1_n32" from="53" to="58">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP-OA</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n33"/>
+      </span>
+      <span id="s1_n33" from="53" to="58">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ADV</f>
+         </fs>
+      </span>
+      <span id="s1_n35" from="59" to="60">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">XY</f>
+         </fs>
+      </span>
+      <span id="s1_n37" from="61" to="66">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP-SB</f>
+         </fs>
+         <rel label="dominates" target="s1_n38"/>
+      </span>
+      <span id="s1_n38" from="61" to="66">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CS</f>
+         </fs>
+         <rel label="dominates" target="s1_n39"/>
+      </span>
+      <span id="s1_n39" from="61" to="66">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">S</f>
+         </fs>
+         <rel label="dominates" target="s1_n40"/>
+      </span>
+      <span id="s1_n40" from="61" to="66">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">VP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n41"/>
+      </span>
+      <span id="s1_n41" from="61" to="66">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ADJD</f>
+         </fs>
+      </span>
+      <span id="s1_n43" from="66" to="67">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">$,</f>
+         </fs>
+      </span>
+      <span id="s1_n45" from="68" to="253">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">PP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n46"/>
+         <rel label="dominates" target="s1_n48"/>
+         <rel label="dominates" uri="morpho.xml#s1_n122"/>
+         <rel label="dominates" uri="morpho.xml#s1_n124"/>
+         <rel label="dominates" uri="morpho.xml#s1_n126"/>
+         <rel label="dominates" uri="morpho.xml#s1_n128"/>
+      </span>
+      <span id="s1_n46" from="68" to="72">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">APPR</f>
+         </fs>
+      </span>
+      <span id="s1_n48" from="73" to="218">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">AP</f>
+         </fs>
+         <rel label="dominates" target="s1_n49"/>
+         <rel label="dominates" uri="morpho.xml#s1_n120"/>
+      </span>
+      <span id="s1_n49" from="73" to="213">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">AVP</f>
+         </fs>
+         <rel label="dominates" target="s1_n50"/>
+      </span>
+      <span id="s1_n50" from="73" to="213">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">S</f>
+         </fs>
+         <rel label="dominates" target="s1_n51"/>
+         <rel label="dominates" uri="morpho.xml#s1_n69"/>
+         <rel label="dominates" target="s1_n71"/>
+         <rel label="dominates" target="s1_n117"/>
+      </span>
+      <span id="s1_n51" from="73" to="127">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP-SB</f>
+         </fs>
+         <rel label="dominates" target="s1_n52"/>
+      </span>
+      <span id="s1_n52" from="73" to="127">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CNP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n53"/>
+         <rel label="dominates" uri="morpho.xml#s1_n55"/>
+         <rel label="dominates" target="s1_n57"/>
+      </span>
+      <span id="s1_n53" from="73" to="78">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">TRUNC</f>
+         </fs>
+      </span>
+      <span id="s1_n55" from="79" to="82">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">KON</f>
+         </fs>
+      </span>
+      <span id="s1_n57" from="83" to="127">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" target="s1_n58"/>
+         <rel label="dominates" uri="morpho.xml#s1_n65"/>
+         <rel label="dominates" uri="morpho.xml#s1_n67"/>
+      </span>
+      <span id="s1_n58" from="83" to="102">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">MPN</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n59"/>
+         <rel label="dominates" uri="morpho.xml#s1_n61"/>
+         <rel label="dominates" uri="morpho.xml#s1_n63"/>
+      </span>
+      <span id="s1_n59" from="83" to="85">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">FM</f>
+         </fs>
+      </span>
+      <span id="s1_n61" from="86" to="88">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">FM</f>
+         </fs>
+      </span>
+      <span id="s1_n63" from="89" to="102">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">FM</f>
+         </fs>
+      </span>
+      <span id="s1_n65" from="103" to="113">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ADJA</f>
+         </fs>
+      </span>
+      <span id="s1_n67" from="114" to="127">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NN</f>
+         </fs>
+      </span>
+      <span id="s1_n69" from="128" to="133">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">VVFIN</f>
+         </fs>
+      </span>
+      <span id="s1_n71" from="134" to="208">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">AVP</f>
+         </fs>
+         <rel label="dominates" target="s1_n72"/>
+      </span>
+      <span id="s1_n72" from="134" to="208">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">S</f>
+         </fs>
+         <rel label="dominates" target="s1_n73"/>
+         <rel label="dominates" uri="morpho.xml#s1_n93"/>
+         <rel label="dominates" target="s1_n95"/>
+      </span>
+      <span id="s1_n73" from="134" to="179">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP-SB</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n74"/>
+         <rel label="dominates" target="s1_n76"/>
+      </span>
+      <span id="s1_n74" from="134" to="137">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ART</f>
+         </fs>
+      </span>
+      <span id="s1_n76" from="138" to="179">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CNP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n77"/>
+         <rel label="dominates" uri="morpho.xml#s1_n79"/>
+         <rel label="dominates" target="s1_n81"/>
+         <rel label="dominates" uri="morpho.xml#s1_n91"/>
+      </span>
+      <span id="s1_n77" from="138" to="149">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NN</f>
+         </fs>
+      </span>
+      <span id="s1_n79" from="150" to="153">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">KON</f>
+         </fs>
+      </span>
+      <span id="s1_n81" from="154" to="178">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n82"/>
+         <rel label="dominates" uri="morpho.xml#s1_n84"/>
+         <rel label="dominates" target="s1_n86"/>
+      </span>
+      <span id="s1_n82" from="154" to="157">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ART</f>
+         </fs>
+      </span>
+      <span id="s1_n84" from="158" to="162">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NN</f>
+         </fs>
+      </span>
+      <span id="s1_n86" from="163" to="178">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n87"/>
+         <rel label="dominates" uri="morpho.xml#s1_n89"/>
+      </span>
+      <span id="s1_n87" from="163" to="169">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">PPOSAT</f>
+         </fs>
+      </span>
+      <span id="s1_n89" from="170" to="178">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NN</f>
+         </fs>
+      </span>
+      <span id="s1_n91" from="178" to="179">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">$.</f>
+         </fs>
+      </span>
+      <span id="s1_n93" from="180" to="183">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">VAFIN</f>
+         </fs>
+      </span>
+      <span id="s1_n95" from="184" to="208">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n96"/>
+         <rel label="dominates" target="s1_n98"/>
+      </span>
+      <span id="s1_n96" from="184" to="187">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">PIS</f>
+         </fs>
+      </span>
+      <span id="s1_n98" from="188" to="208">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n99"/>
+         <rel label="dominates" target="s1_n101"/>
+      </span>
+      <span id="s1_n99" from="188" to="191">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ART</f>
+         </fs>
+      </span>
+      <span id="s1_n101" from="192" to="208">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">CNP</f>
+         </fs>
+         <rel label="dominates" target="s1_n102"/>
+         <rel label="dominates" uri="morpho.xml#s1_n107"/>
+         <rel label="dominates" target="s1_n109"/>
+         <rel label="dominates" target="s1_n112"/>
+      </span>
+      <span id="s1_n102" from="192" to="198">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n103"/>
+         <rel label="dominates" uri="morpho.xml#s1_n105"/>
+      </span>
+      <span id="s1_n103" from="192" to="196">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">APPR</f>
+         </fs>
+      </span>
+      <span id="s1_n105" from="197" to="198">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">XY</f>
+         </fs>
+      </span>
+      <span id="s1_n107" from="198" to="199">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">$,</f>
+         </fs>
+      </span>
+      <span id="s1_n109" from="200" to="202">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">AVP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n110"/>
+      </span>
+      <span id="s1_n110" from="200" to="202">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ADV</f>
+         </fs>
+      </span>
+      <span id="s1_n112" from="203" to="208">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n113"/>
+         <rel label="dominates" uri="morpho.xml#s1_n115"/>
+      </span>
+      <span id="s1_n113" from="203" to="204">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">XY</f>
+         </fs>
+      </span>
+      <span id="s1_n115" from="205" to="208">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">XY</f>
+         </fs>
+      </span>
+      <span id="s1_n117" from="209" to="213">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NP-DA</f>
+         </fs>
+         <rel label="dominates" uri="morpho.xml#s1_n118"/>
+      </span>
+      <span id="s1_n118" from="209" to="213">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">PRF</f>
+         </fs>
+      </span>
+      <span id="s1_n120" from="214" to="218">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">PIDAT</f>
+         </fs>
+      </span>
+      <span id="s1_n122" from="220" to="226">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ADJA</f>
+         </fs>
+      </span>
+      <span id="s1_n124" from="227" to="240">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">ADJA</f>
+         </fs>
+      </span>
+      <span id="s1_n126" from="241" to="249">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">NN</f>
+         </fs>
+      </span>
+      <span id="s1_n128" from="250" to="253">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">XY</f>
+         </fs>
+      </span>
+      <span id="s1_n130" from="253" to="254">
+         <fs xmlns="http://www.tei-c.org/ns/1.0" type="node">
+            <f name="const">$.</f>
+         </fs>
+      </span>
+   </spanList>
+</layer>