Minor improvements by introducing getters and setters instead of combinators

Change-Id: Ifcc801bab9ae8d085cef492880e81b7c0c71d19c
diff --git a/lib/KorAP/XML/Annotation/DGD/Structure.pm b/lib/KorAP/XML/Annotation/DGD/Structure.pm
index a2192ae..4b49349 100644
--- a/lib/KorAP/XML/Annotation/DGD/Structure.pm
+++ b/lib/KorAP/XML/Annotation/DGD/Structure.pm
@@ -76,7 +76,7 @@
       p_end   => $_->[0],
       pti     => 64
     );
-    $mt->payload('<b>1');
+    $mt->set_payload('<b>1');
     $sentences++;
 
     $p_start = $_->[0];
diff --git a/lib/KorAP/XML/Annotation/DeReKo/Structure.pm b/lib/KorAP/XML/Annotation/DeReKo/Structure.pm
index cc2b751..d56173a 100644
--- a/lib/KorAP/XML/Annotation/DeReKo/Structure.pm
+++ b/lib/KorAP/XML/Annotation/DeReKo/Structure.pm
@@ -63,7 +63,7 @@
         my $pl;
         $pl .= '<b>' . ($level ? $level - 1 : 0);
         $pl .= '<s>' . $tui if $tui;
-        $mt->payload($pl);
+        $mt->set_payload($pl);
       };
 
       # Use sentence and paragraph elements for base
@@ -72,8 +72,8 @@
         if ($name eq 's' && index($as_base, 'sentences') >= 0) {
           # Clone Multiterm
           my $mt2 = $mt->clone;
-          $mt2->term('<>:base/s:' . $name);
-          $mt2->payload('<b>2');
+          $mt2->set_term('<>:base/s:' . $name);
+          $mt2->set_payload('<b>2');
           $sentences++;
 
           # Add to stream
@@ -82,8 +82,8 @@
         elsif ($name eq 'p' && index($as_base, 'paragraphs') >= 0) {
           # Clone Multiterm
           my $mt2 = $mt->clone;
-          $mt2->term('<>:base/s:' . $name);
-          $mt2->payload('<b>1');
+          $mt2->set_term('<>:base/s:' . $name);
+          $mt2->set_payload('<b>1');
           $paragraphs++;
 
           # Add to stream
@@ -95,8 +95,8 @@
           if (my $nr = first { $_->{-name} eq 'n' } @$attrs) {
             if (($nr = $nr->{'#text'}) && looks_like_number($nr)) {
               my $mt2 = $mtt->add('~:base/s:pb');
-              $mt2->payload('<i>' . $nr . '<i>' . $span->o_start);
-              $mt2->store_offsets(0);
+              $mt2->set_payload('<i>' . $nr . '<i>' . $span->o_start);
+              $mt2->set_stored_offsets(0);
             };
           };
         };
diff --git a/lib/KorAP/XML/Annotation/RWK/Structure.pm b/lib/KorAP/XML/Annotation/RWK/Structure.pm
index 82de1c7..0d1bb2f 100644
--- a/lib/KorAP/XML/Annotation/RWK/Structure.pm
+++ b/lib/KorAP/XML/Annotation/RWK/Structure.pm
@@ -88,7 +88,7 @@
         p_end   => $_->[0],
         pti     => 64
       );
-      $mt->payload('<b>1');
+      $mt->set_payload('<b>1');
 
       if ($type eq 's') {
         $sentences++;
diff --git a/lib/KorAP/XML/Index/MultiTerm.pm b/lib/KorAP/XML/Index/MultiTerm.pm
index 7e089de..90253e5 100644
--- a/lib/KorAP/XML/Index/MultiTerm.pm
+++ b/lib/KorAP/XML/Index/MultiTerm.pm
@@ -6,143 +6,155 @@
 # Todo: This should store only the pti and the payload - with clever access using the pti!
 # Everything should be stored as bytes already (if this is feasible)
 
+use constant {
+  PAYLOAD => 0,
+  P_START => 1,
+  P_END => 2,
+  O_START => 3,
+  O_END => 4,
+  TERM => 5,
+  STORED_OFFSETS => 6,
+  PTI => 7, # former 10
+  TUI => 8,
+};
+
 sub new {
   my $self = bless [], shift;
-  my $i = 0;
-  for (; $i < scalar @_; $i+=2) {
+  for (my $i = 0; $i < scalar @_; $i+=2) {
     if ($_[$i] eq 'term') {
-      $self->term($_[$i+1]);
+      $self->[TERM] = $_[$i+1];
     }
     elsif ($_[$i] eq 'p_start') {
-      $self->p_start($_[$i+1]);
+      $self->[P_START] = $_[$i+1];
     }
     elsif ($_[$i] eq 'p_end') {
-      $self->p_end($_[$i+1]);
+      $self->[P_END] = $_[$i+1];
     }
     elsif ($_[$i] eq 'payload') {
-      $self->payload($_[$i+1]);
+      $self->[PAYLOAD] = $_[$i+1];
     }
     elsif ($_[$i] eq 'store_offsets') {
       $self->store_offsets($_[$i+1]);
     }
     elsif ($_[$i] eq 'o_start') {
-      $self->o_start($_[$i+1]);
+      $self->[O_START] = $_[$i+1];
     }
     elsif ($_[$i] eq 'o_end') {
-      $self->o_end($_[$i+1]);
+      $self->[O_END] = $_[$i+1];
     }
     elsif ($_[$i] eq 'pti') {
-      $self->pti($_[$i+1]);
+      $self->[PTI] = $_[$i+1];
     }
     elsif ($_[$i] eq 'tui') {
-      $self->tui($_[$i+1]);
+      $self->[TUI] = $_[$i+1];
     };
   };
   $self;
 };
 
-# 0
-sub payload {
-  if (defined $_[1]) {
-    return $_[0]->[0] = $_[1];
-  };
-  $_[0]->[0];
+sub set_payload {
+  return $_[0]->[PAYLOAD] = $_[1];
 };
 
-# 1
-sub p_start {
-  if (defined $_[1]) {
-    return $_[0]->[1] = $_[1];
-  };
-  $_[0]->[1] // 0;
+sub get_payload {
+  $_[0]->[PAYLOAD];
 };
 
-# 2
-sub p_end {
-  if (defined $_[1]) {
-    return $_[0]->[2] = $_[1];
-  };
-  $_[0]->[2] // 0;
+sub set_p_start {
+  return $_[0]->[P_START] = $_[1];
 };
 
-# 3
-sub o_start {
-  if (defined $_[1]) {
-    return $_[0]->[3] = $_[1];
-  };
-  $_[0]->[3] // 0;
+sub get_p_start {
+  $_[0]->[P_START] // 0;
 };
 
-# 4
-sub o_end {
-  if (defined $_[1]) {
-    return $_[0]->[4] = $_[1];
-  };
-  $_[0]->[4] // 0;
+sub set_p_end {
+  $_[0]->[P_END] = $_[1];
 };
 
-# 5
-sub term {
-  if (defined $_[1]) {
-    return $_[0]->[5] = $_[1];
-  };
-  $_[0]->[5] // '';
+sub get_p_end {
+  $_[0]->[P_END] // 0
 };
 
-# 6
-sub store_offsets {
-  if (defined $_[1]) {
-    return $_[0]->[6] = $_[1];
-  };
-  $_[0]->[6];
+sub set_o_start {
+  return $_[0]->[O_START] = $_[1];
 };
 
-# pti
-sub pti {
-  if (defined $_[1]) {
-    return $_[0]->[10] = $_[1];
-  };
-  $_[0]->[10];
+sub get_o_start {
+  $_[0]->[O_START] // 0;
 };
 
-# Not serialized - just setter/getter
-sub tui {
-  if (defined $_[1]) {
-    return $_[0]->[11] = $_[1];
-  };
-  $_[0]->[11];
+sub set_o_end {
+  $_[0]->[O_END] = $_[1];
 };
 
+sub get_o_end {
+  $_[0]->[O_END] // 0;
+};
+
+sub set_term {
+  return $_[0]->[TERM] = $_[1];
+};
+
+sub get_term {
+  $_[0]->[TERM] // '';
+};
+
+sub set_stored_offsets {
+  return $_[0]->[STORED_OFFSETS] = $_[1];
+};
+
+sub get_stored_offsets {
+  $_[0]->[STORED_OFFSETS];
+};
+
+sub set_pti {
+  return $_[0]->[PTI] = $_[1];
+};
+
+sub get_pti {
+  $_[0]->[PTI];
+};
+
+sub set_tui {
+  return $_[0]->[TUI] = $_[1];
+};
+
+sub get_tui {
+  $_[0]->[TUI];
+};
+
+
 # To string based on array
 sub to_string {
-  my $string = _escape_term($_[0]->[5]);
+  my $string = _escape_term($_[0]->[TERM]);
 
   my $pre;
 
   # PTI
-  $pre .= '<b>' . $_[0]->[10] if  $_[0]->[10];
+  $pre .= '<b>' . $_[0]->[PTI] if  $_[0]->[PTI];
 
   # Offsets
-  if (defined $_[0]->[3]) {
-    $pre .= '<i>' .$_[0]->[3] .
-      '<i>' . $_[0]->[4];
+  if (defined $_[0]->[O_START]) {
+    $pre .= '<i>' .$_[0]->[O_START] .
+      '<i>' . $_[0]->[O_END];
   };
 
   #  my $pl = $_[0]->[1] ?
   #    $_[0]->[1] - 1 : $_[0]->[0];
 
-  if ($_[0]->[2] || $_[0]->[0]) {
+  if ($_[0]->[P_END] || $_[0]->[PAYLOAD]) {
 
     # p_end
-    if (defined $_[0]->[2]) {
-      $pre .= '<i>' . $_[0]->[2];
+    if (defined $_[0]->[P_END]) {
+      $pre .= '<i>' . $_[0]->[P_END];
     };
     if ($_[0]->[0]) {
-      if (index($_[0]->[0], '<') == 0) {
-        $pre .= $_[0]->[0];
+      if (index($_[0]->[PAYLOAD], '<') == 0) {
+        $pre .= $_[0]->[PAYLOAD];
       }
       else {
-        $pre .= '<?>' . $_[0]->[0];
+        $pre .= '<?>' . $_[0]->[PAYLOAD];
       };
     };
   };
@@ -156,31 +168,6 @@
   bless [@$self], __PACKAGE__;
 };
 
-sub to_string_2 {
-  my $self = shift;
-  my $string = $self->term;
-  if (defined $self->o_start) {
-    $string .= '#' .$self->o_start .'-' . $self->o_end;
-  };
-
-  my $pl = $self->p_end ? $self->p_end - 1 : $self->payload;
-  if ($self->p_end || $self->payload) {
-    $string .= '$';
-    if ($self->p_end) {
-      $string .= '<i>' . $self->p_end;
-    };
-    if ($self->payload) {
-      if (index($self->payload, '<') == 0) {
-        $string .= $self->payload;
-      }
-      else {
-        $string .= '<?>' . $self->payload;
-      };
-    };
-  };
-
-  return $string;
-};
 
 sub _escape_term ($) {
   my $str = shift;
@@ -189,71 +176,4 @@
 };
 
 
-# DEPRECATED
-sub to_solr {
-  my $self = shift;
-  my $increment = shift;
-
-  my (@payload_types, @payload) = ();
-
-  my $term = $self->term;
-  if ($term =~ s/\#(\d+)-(\d+)//) {
-    push(@payload, $1, $2);
-    push(@payload_types, 'l', 'l');
-  };
-
-  my %term = ( t => $term );
-  if (defined $increment && $increment == 0) {
-    $term{i} = 0;
-  };
-
-  if (defined $self->o_start && !@payload) {
-    push(@payload, $self->o_start, $self->o_end);
-    push(@payload_types, 'l', 'l');
-  };
-
-  if ($self->p_end || $self->payload) {
-    if ($self->p_end) {
-      push(@payload, $self->p_end);
-      push(@payload_types, 'l');
-    };
-    if ($self->payload) {
-      if (index($self->payload, '<') == 0) {
-	my @pls = split /(?=<)|(?<=>)/, $self->payload;
-	for (my $i = 0; $i < @pls; $i+=2) {
-	  if ($pls[$i] eq 'b') {
-	    push(@payload, $pls[$i+1]);
-	    push(@payload_types, 'c');
-	  }
-	  elsif ($pls[$i] eq 's') {
-	    push(@payload, $pls[$i+1]);
-	    push(@payload_types, 's');
-	  }
-	  elsif ($pls[$i] eq 'i') {
-	    push(@payload, $pls[$i+1]);
-	    push(@payload_types, 'l');
-	  }
-	  elsif ($pls[$i] eq 'l') {
-	    push(@payload, $pls[$i+1]);
-	    push(@payload_types, 'q');
-	  }
-	  else {
-	    push(@payload, $pls[$i+1]);
-	    push(@payload_types, 'w*');
-	  };
-	};
-      }
-      else {
-	push(@payload, $self->payload);
-	push(@payload_types, 'w*');
-      };
-    };
-  };
-  if (@payload) {
-    $term{p} = encode_base64(pack(join('', @payload_types), @payload), '');
-  };
-
-  return \%term;
-};
-
 1;
diff --git a/lib/KorAP/XML/Index/MultiTermToken.pm b/lib/KorAP/XML/Index/MultiTermToken.pm
index 3556422..2815eff 100644
--- a/lib/KorAP/XML/Index/MultiTermToken.pm
+++ b/lib/KorAP/XML/Index/MultiTermToken.pm
@@ -10,6 +10,13 @@
 # but is rather slow on sorting relations.
 # Should be replaced by an efficient implementation!
 
+use constant {
+  MT      => 0,
+  O_START => 1,
+  O_END   => 2,
+  ID_COUNTER => 3
+};
+
 sub new {
   bless [], shift;
 };
@@ -30,33 +37,30 @@
   else {
     $mt = $_[0];
   };
-  $self->[0] //= [];
-  push(@{$self->[0]}, $mt);
+  $self->[MT] //= [];
+  push(@{$self->[MT]}, $mt);
   $mt;
 };
 
-# 0 -> mt
-
-# 1
-sub o_start {
-  if (defined $_[1]) {
-    return $_[0]->[1] = $_[1];
-  };
-  $_[0]->[1];
+sub set_o_start {
+  return $_[0]->[O_START] = $_[1];
 };
 
-# 2
-sub o_end {
-  if (defined $_[1]) {
-    return $_[0]->[2] = $_[1];
-  };
-  $_[0]->[2];
+sub get_o_start {
+  $_[0]->[O_START]
 };
 
-# 3: Return a new term id
+sub set_o_end {
+  return $_[0]->[O_END] = $_[1];
+};
+
+sub get_o_end {
+  $_[0]->[O_END]
+};
+
 sub id_counter {
-  $_[0]->[3] //= 1;
-  return $_[0]->[3]++;
+  $_[0]->[ID_COUNTER] //= 1;
+  return $_[0]->[ID_COUNTER]++;
 };
 
 sub surface {
@@ -85,7 +89,7 @@
 
 sub to_string {
   my $self = shift;
-  my $string = '[(' . $self->o_start . '-'. $self->o_end . ')';
+  my $string = '[(' . $self->get_o_start . '-'. $self->get_o_end . ')';
   $string .= join ('|', @{$self->to_array});
   $string .= ']';
   return $string;
@@ -121,6 +125,7 @@
   return (0,0);
 };
 
+
 # Sort spans, attributes and relations
 sub _sort {
 
@@ -135,64 +140,61 @@
       my ($a_id) = ($a->[0] =~ m/^<s>(\d+)/);
       my ($b_id) = ($b->[0] =~ m/^<s>(\d+)/);
       if ($a_id > $b_id) {
-	return 1;
+        return 1;
       }
       elsif ($a_id < $b_id) {
-	return -1;
+        return -1;
       }
       else {
-	return 1;
+        return 1;
       };
     }
 
     # Both are relations
     elsif (
       (index($a->[5],'<:') == 0 || index($a->[5],'>:') == 0)  &&
-      (index($b->[5], '<:') == 0 || index($b->[5],'>:') == 0)) {
+        (index($b->[5], '<:') == 0 || index($b->[5],'>:') == 0)) {
 
-      my $a_end = ($a->pti < 34 ? $a->p_start : (
-	($a->pti == 35 ? ($a->[0] =~ /^(?:<i>\d+){4}<i>(\d+)</ && $1) :
-	   ($a->[0] =~ /^(?:<i>\d+){2}<i>(\d+)</ && $1)
-	)
+      my $a_end = ($a->get_pti < 34 ? $a->get_p_start : (
+        ($a->get_pti == 35 ? ($a->[0] =~ /^(?:<i>\d+){4}<i>(\d+)</ && $1) :
+           ($a->[0] =~ /^(?:<i>\d+){2}<i>(\d+)</ && $1)
+         )
       ));
 
-      my $b_end = ($b->pti < 34 ? $b->p_start : (
-	($b->pti == 35 ? ($b->[0] =~ /^(?:<i>\d+){4}<i>(\d+)</ && $1) :
-	   ($b->[0] =~ /^(?:<i>\d+){2}<i>(\d+)</ && $1)
-	 )
+      my $b_end = ($b->get_pti < 34 ? $b->get_p_start : (
+        ($b->get_pti == 35 ? ($b->[0] =~ /^(?:<i>\d+){4}<i>(\d+)</ && $1) :
+           ($b->[0] =~ /^(?:<i>\d+){2}<i>(\d+)</ && $1)
+         )
       ));
 
-#      my $a_end = $a->[2] // 0;
-#      my $b_end = $b->[2] // 0;
-
       # left is p_end
       if ($a_end < $b_end) {
-	return -1;
+        return -1;
       }
       elsif ($a_end > $b_end) {
-	return 1;
+        return 1;
       }
       else {
-	# Both are either > or <
+        # Both are either > or <
 
-	# Check for right positions
-	(my $a_start, $a_end) = _rel_right_pos($a->pti, $a->[0]);
-	(my $b_start, $b_end) = _rel_right_pos($b->pti, $b->[0]);
-	if ($a_start < $b_start) {
-	  return -1;
-	}
-	elsif ($a_start > $b_start) {
-	  return 1;
-	}
-	elsif ($a_end < $b_end) {
-	  return -1;
-	}
-	elsif ($a_end > $b_end) {
-	  return 1;
-	}
-	else {
-	  return 1;
-	};
+        # Check for right positions
+        (my $a_start, $a_end) = _rel_right_pos($a->get_pti, $a->[0]);
+        (my $b_start, $b_end) = _rel_right_pos($b->get_pti, $b->[0]);
+        if ($a_start < $b_start) {
+          return -1;
+        }
+        elsif ($a_start > $b_start) {
+          return 1;
+        }
+        elsif ($a_end < $b_end) {
+          return -1;
+        }
+        elsif ($a_end > $b_end) {
+          return 1;
+        }
+        else {
+          return 1;
+        };
       };
     };
 
@@ -226,54 +228,20 @@
       $a_depth //= 0;
       $b_depth //= 0;
       if ($a_depth < $b_depth) {
-	return -1;
+        return -1;
       }
       elsif ($a_depth > $b_depth) {
-	return 1;
+        return 1;
       }
       else {
-	return $a->[5] cmp $b->[5];
+        return $a->[5] cmp $b->[5];
       };
     };
   };
 };
 
 
-sub to_solr {
-  my $self = shift;
-  my @array = map { $_->to_solr(0) } @{$self->{mt}};
-  $array[0]->{i} = 1;
-  return \@array;
-};
-
-
 1;
 
 
 __END__
-
-[
-  {
-   "e":128,
-   "i":22,
-   "p":"DQ4KDQsODg8=",
-   "s":123,
-   "t":"one",
-   "y":"word"
-  },
-  {
-   "e":8,
-   "i":1,
-   "s":5,
-   "t":"two",
-   "y":"word"
-  },
-  {
-   "e":22,
-   "i":1,
-   "s":20,
-   "t":"three",
-   "y":"foobar"
-  }
- ]
-
diff --git a/lib/KorAP/XML/Index/MultiTermTokenStream.pm b/lib/KorAP/XML/Index/MultiTermTokenStream.pm
index 7824ae3..1b7bfa2 100644
--- a/lib/KorAP/XML/Index/MultiTermTokenStream.pm
+++ b/lib/KorAP/XML/Index/MultiTermTokenStream.pm
@@ -1,15 +1,21 @@
 package KorAP::XML::Index::MultiTermTokenStream;
-use Mojo::Base -base;
+use strict;
+use warnings;
 use KorAP::XML::Index::MultiTermToken;
 
-has [qw/oStart oEnd/];
+use constant {
+  MTT => 0,
+  TUI => 1
+};
+
+sub new {
+  bless [[],[]], shift;
+};
 
 sub add {
   my $self = shift;
   my $mtt = shift // KorAP::XML::Index::MultiTermToken->new;
-  $self->{mtt} //= [];
-  $self->{tui} //= [];
-  push(@{$self->{mtt}}, $mtt);
+  push(@{$self->[MTT]}, $mtt);
   return $mtt;
 };
 
@@ -62,41 +68,36 @@
   my $self = shift;
   my $pos_0 = $self->pos(0) or return;
   my $mt = $pos_0->add('-:' . shift);
-  $mt->payload(shift);
-  $mt->store_offsets(0);
+  $mt->set_payload(shift);
+  $mt->set_stored_offsets(0);
 };
 
 sub pos {
   my $self = shift;
   my $pos = shift;
   return unless defined $pos;
-  return $self->{mtt}->[$pos];
+  return $self->[MTT]->[$pos];
 };
 
 sub to_string {
   my $self = shift;
-  return join("\n" , map { $_->to_string } @{$self->{mtt}}) . "\n";
+  return join("\n" , map { $_->to_string } @{$self->[MTT]}) . "\n";
 };
 
 sub multi_term_tokens {
-  $_[0]->{mtt};
+  $_[0]->[MTT];
 };
 
 sub tui {
   my $self = shift;
   my $pos = shift;
   return unless defined $pos;
-  return ++$self->{tui}->[$pos];
+  return ++$self->[TUI]->[$pos];
 };
 
 sub to_array {
   my $self = shift;
-  [ map { $_->to_array } @{$self->{mtt}} ];
-};
-
-sub to_solr {
-  my $self = shift;
-  [ map { $_->to_solr } @{$self->{mtt}} ];
+  [ map { $_->to_array } @{$self->[MTT]} ];
 };
 
 1;
diff --git a/lib/KorAP/XML/Tokenizer.pm b/lib/KorAP/XML/Tokenizer.pm
index 59ae17f..65daa94 100644
--- a/lib/KorAP/XML/Tokenizer.pm
+++ b/lib/KorAP/XML/Tokenizer.pm
@@ -178,8 +178,8 @@
     $mtt->add('i:' . fc $token);
 
     # Add offset information
-    $mtt->o_start($from);
-    $mtt->o_end($to);
+    $mtt->set_o_start($from);
+    $mtt->set_o_end($to);
 
     # Store offset information for position matching
     $range->set($from, $to, $have);
@@ -190,8 +190,8 @@
     # Add position term
     $mtt->add(
       term => '_' . $have,
-      o_start => $mtt->o_start,
-      o_end => $mtt->o_end
+      o_start => $mtt->get_o_start,
+      o_end => $mtt->get_o_end
     );
 
     $have++;
diff --git a/lib/KorAP/XML/Tokenizer/Span.pm b/lib/KorAP/XML/Tokenizer/Span.pm
index 7d7bd55..962d002 100644
--- a/lib/KorAP/XML/Tokenizer/Span.pm
+++ b/lib/KorAP/XML/Tokenizer/Span.pm
@@ -19,6 +19,10 @@
   $_[0]->[0];
 };
 
+sub set_o_start {
+  $_[0]->[0] = $_[1];
+};
+
 sub o_end {
   if (defined $_[1]) {
     $_[0]->[1] = $_[1];
@@ -26,6 +30,10 @@
   $_[0]->[1];
 };
 
+sub set_o_end {
+  $_[0]->[1] = $_[1];
+};
+
 sub p_start {
   if (defined $_[1]) {
     $_[0]->[2] = $_[1];
@@ -33,6 +41,10 @@
   $_[0]->[2];
 };
 
+sub set_p_start {
+  $_[0]->[2] = $_[1];
+};
+
 sub p_end {
   if (defined $_[1]) {
     $_[0]->[3] = $_[1];
@@ -40,6 +52,10 @@
   $_[0]->[3];
 };
 
+sub set_p_end {
+  $_[0]->[3] = $_[1];
+};
+
 sub id {
   if (defined $_[1]) {
     $_[0]->[4] = $_[1];
diff --git a/lib/KorAP/XML/Tokenizer/Units.pm b/lib/KorAP/XML/Tokenizer/Units.pm
index 3ace9eb..7d31626 100644
--- a/lib/KorAP/XML/Tokenizer/Units.pm
+++ b/lib/KorAP/XML/Tokenizer/Units.pm
@@ -83,7 +83,7 @@
 
       # The next token of end has a character
       # offset AFTER the given end character offset
-      my $real_start = $self->stream->pos($end)->o_start;
+      my $real_start = $self->stream->pos($end)->get_o_start;
 
       # Ignore non-milestone elements outside the token stream!
       if ($to <= $real_start) {
diff --git a/t/real/sgbr/script_single.t b/t/real/sgbr/script_single.t
index 934ce8a..553560a 100644
--- a/t/real/sgbr/script_single.t
+++ b/t/real/sgbr/script_single.t
@@ -17,9 +17,9 @@
 };
 
 my $f = dirname(__FILE__);
-my $script = catfile($f, '..', '..', 'script', 'korapxml2krill');
+my $script = catfile($f, '..', '..', '..', 'script', 'korapxml2krill');
 
-my $input = catdir($f, '..', 'sgbr', 'PRO-DUD', 'BSP-2013-01', '32');
+my $input = catdir($f, 'PRO-DUD', 'BSP-2013-01', '32');
 
 my $output = tmpnam();
 my $cache = tmpnam();
diff --git a/t/sort_tokens.t b/t/sort_tokens.t
index b5683d5..0db2c59 100644
--- a/t/sort_tokens.t
+++ b/t/sort_tokens.t
@@ -9,8 +9,8 @@
 use_ok('KorAP::XML::Index::MultiTermTokenStream');
 
 ok(my $mtt = KorAP::XML::Index::MultiTermToken->new, 'New token');
-ok(defined $mtt->o_start(0), 'Set start character offset');
-ok($mtt->o_end(5), 'Set end character offset');
+ok(defined $mtt->set_o_start(0), 'Set start character offset');
+ok($mtt->set_o_end(5), 'Set end character offset');
 ok($mtt->add(term => '@:k=N',
 	     pti => 128,
 	     payload =>'<s>9'), 'Add token');
@@ -71,8 +71,8 @@
    'Check string');
 
 ok($mtt = KorAP::XML::Index::MultiTermToken->new, 'New token');
-ok(defined $mtt->o_start(0), 'Set start character offset');
-ok($mtt->o_end(5), 'Set end character offset');
+ok(defined $mtt->set_o_start(0), 'Set start character offset');
+ok($mtt->set_o_end(5), 'Set end character offset');
 
 # 2-7 to 2-4
 ok($mtt->add(term => '<:child-of',
diff --git a/t/tokens.t b/t/tokens.t
index ce083dd..9ea5bcd 100644
--- a/t/tokens.t
+++ b/t/tokens.t
@@ -16,36 +16,36 @@
   o_end => 120
 ), 'Create new object');
 
-is($term->term, 'Baum');
-is($term->p_start, 0);
-is($term->p_end, 56);
-is($term->o_start, 34);
-is($term->o_end, 120);
-is($term->payload, '<i>56');
+is($term->get_term, 'Baum');
+is($term->get_p_start, 0);
+is($term->get_p_end, 56);
+is($term->get_o_start, 34);
+is($term->get_o_end, 120);
+is($term->get_payload, '<i>56');
 is($term->to_string, 'Baum$<i>34<i>120<i>56<i>56');
 
 ok($term = KorAP::XML::Index::MultiTerm->new(
   term => 'Baum'
 ), 'Create new object');
 
-is($term->term, 'Baum');
-is($term->p_start, 0);
-is($term->p_end, 0);
-is($term->o_start, 0);
-is($term->o_end, 0);
-is($term->payload, undef);
+is($term->get_term, 'Baum');
+is($term->get_p_start, 0);
+is($term->get_p_end, 0);
+is($term->get_o_start, 0);
+is($term->get_o_end, 0);
+is($term->get_payload, undef);
 is($term->to_string, 'Baum');
 
 ok($term = KorAP::XML::Index::MultiTerm->new(
   term => 'Ba#um'
 ), 'Create new object');
 
-is($term->term, 'Ba#um');
-is($term->p_start, 0);
-is($term->p_end, 0);
-is($term->o_start, 0);
-is($term->o_end, 0);
-is($term->payload, undef);
+is($term->get_term, 'Ba#um');
+is($term->get_p_start, 0);
+is($term->get_p_end, 0);
+is($term->get_o_start, 0);
+is($term->get_o_end, 0);
+is($term->get_payload, undef);
 is($term->to_string, 'Ba\#um');
 
 ok($term = KorAP::XML::Index::MultiTerm->new(
@@ -53,12 +53,12 @@
   payload => '<i>45'
 ), 'Create new object');
 
-is($term->term, 'Ba#u$m');
-is($term->p_start, 0);
-is($term->p_end, 0);
-is($term->o_start, 0);
-is($term->o_end, 0);
-is($term->payload, '<i>45');
+is($term->get_term, 'Ba#u$m');
+is($term->get_p_start, 0);
+is($term->get_p_end, 0);
+is($term->get_o_start, 0);
+is($term->get_o_end, 0);
+is($term->get_payload, '<i>45');
 is($term->to_string, 'Ba\#u\$m$<i>45');
 
 use_ok('KorAP::XML::Tokenizer');
diff --git a/xt/benchmark.pl b/xt/benchmark.pl
index 69fc908..f481a83 100644
--- a/xt/benchmark.pl
+++ b/xt/benchmark.pl
@@ -73,7 +73,7 @@
     }
   ),
   Dumbbench::Instance::PerlSub->new(
-    name => 'Conversion-GOE-Tagged-1',
+    name => 'Script-Conversion-GOE-Tagged-1',
     code => sub {
       my $doc = KorAP::XML::Krill->new(path => $path . '/');
       $doc->parse;