[med-svn] [pysam] 01/13: Imported Upstream version 0.7.1

Charles Plessy plessy at alioth.debian.org
Fri Aug 9 09:47:26 UTC 2013


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch master
in repository pysam.

commit 11d21483ba2333249960e114ca3785d4476ac3d7
Author: Charles Plessy <plessy at debian.org>
Date:   Fri Aug 9 18:34:23 2013 +0900

    Imported Upstream version 0.7.1
---
 MANIFEST.in                |    3 +-
 PKG-INFO                   |    2 +-
 pysam.egg-info/PKG-INFO    |    2 +-
 pysam.egg-info/SOURCES.txt |    2 +-
 pysam/TabProxies.c         |    4 +-
 pysam/VCF.py               | 1087 -----
 pysam/__init__.py          |    2 +-
 pysam/csamtools.c          |10764 ++++++++++++++++----------------------------
 pysam/csamtools.pyx        |    8 +-
 pysam/ctabix.c             | 1670 +++----
 pysam/ctabix.pyx           |    3 +
 pysam/cvcf.c               |   33 +-
 pysam/version.py           |    2 +-
 setup.cfg                  |    4 +-
 setup.py                   |   43 +-
 tests/example_btag.bam     |  Bin 0 -> 771 bytes
 tests/pysam_test.py        |   10 +
 17 files changed, 4935 insertions(+), 8704 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index f613856..0fe44fe 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -21,6 +21,7 @@ include pysam/TabProxies.pxd
 include pysam/cvcf.pyx
 include pysam/cvcf.pxd
 include pysam/cvcf.c
+include pysam/*.c
 include pysam/pysam_util.h
 include samtools/*.h
 include samtools/*/*.h
@@ -44,6 +45,7 @@ include tests/example.py
 include tests/pysam_test.py
 include tests/segfault_tests.py
 include tests/example_*.sam
+include tests/example_btag.bam
 include tests/tag_bug.bam
 include tests/example.vcf40
 include tests/example_empty_header.bam
@@ -56,4 +58,3 @@ include tests/example.gtf.gz.tbi
 include tests/example.bed.gz
 include tests/example.bed.gz.tbi
 include tests/vcf-examples/*.vcf
-
diff --git a/PKG-INFO b/PKG-INFO
index 6e727bf..e0b77b4 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pysam
-Version: 0.7
+Version: 0.7.1
 Summary: pysam
 Home-page: http://code.google.com/p/pysam/
 Author: Andreas Heger
diff --git a/pysam.egg-info/PKG-INFO b/pysam.egg-info/PKG-INFO
index 6e727bf..e0b77b4 100644
--- a/pysam.egg-info/PKG-INFO
+++ b/pysam.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pysam
-Version: 0.7
+Version: 0.7.1
 Summary: pysam
 Home-page: http://code.google.com/p/pysam/
 Author: Andreas Heger
diff --git a/pysam.egg-info/SOURCES.txt b/pysam.egg-info/SOURCES.txt
index b59e914..31820bd 100644
--- a/pysam.egg-info/SOURCES.txt
+++ b/pysam.egg-info/SOURCES.txt
@@ -10,7 +10,6 @@ pysam/Pileup.py
 pysam/TabProxies.c
 pysam/TabProxies.pxd
 pysam/TabProxies.pyx
-pysam/VCF.py
 pysam/__init__.py
 pysam/csamtools.c
 pysam/csamtools.pxd
@@ -141,6 +140,7 @@ tests/example.gtf.gz
 tests/example.gtf.gz.tbi
 tests/example.py
 tests/example.vcf40
+tests/example_btag.bam
 tests/example_btag.sam
 tests/example_empty_header.bam
 tests/example_unmapped_reads_no_sq.sam
diff --git a/pysam/TabProxies.c b/pysam/TabProxies.c
index 8c393e0..df3c35e 100644
--- a/pysam/TabProxies.c
+++ b/pysam/TabProxies.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.16 on Tue Nov 20 16:56:59 2012 */
+/* Generated by Cython 0.16 on Tue Nov 20 15:06:33 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -970,7 +970,7 @@ static char __pyx_k_54[] = "feature strand.";
 static char __pyx_k_55[] = "feature frame.";
 static char __pyx_k_56[] = "feature attributes (as a string).";
 static char __pyx_k_57[] = "getfilesystemencoding";
-static char __pyx_k_60[] = "/ifs/devel/pysam/pysam/TabProxies.pyx";
+static char __pyx_k_60[] = "/home/andreas/devel/pysam/pysam/TabProxies.pyx";
 static char __pyx_k__v[] = "v";
 static char __pyx_k__id[] = "id";
 static char __pyx_k__alt[] = "alt";
diff --git a/pysam/VCF.py b/pysam/VCF.py
deleted file mode 100644
index 94d63f8..0000000
--- a/pysam/VCF.py
+++ /dev/null
@@ -1,1087 +0,0 @@
-#
-# Code to read, write and edit VCF files
-#
-# VCF lines are encoded as a dictionary with these keys (note: all lowercase):
-# 'chrom':  string
-# 'pos':    integer
-# 'id':     string
-# 'ref':    string
-# 'alt':    list of strings
-# 'qual':   integer
-# 'filter': None (missing value), or list of keys (strings); empty list parsed as ["PASS"]
-# 'info':   dictionary of values (see below)
-# 'format': list of keys (strings)
-# sample keys: dictionary of values (see below)
-#
-# The sample keys are accessible through vcf.getsamples()
-#
-# A dictionary of values contains value keys (defined in ##INFO or ##FORMAT lines) which map
-# to a list, containign integers, floats, strings, or characters.  Missing values are replaced 
-# by a particular value, often -1 or .
-#
-# Genotypes are not stored as a string, but as a list of 1 or 3 elements (for haploid and diploid samples),
-# the first (and last) the integer representing an allele, and the second the separation character.
-# Note that there is just one genotype per sample, but for consistency the single element is stored in a list.
-#
-# Header lines other than ##INFO, ##FORMAT and ##FILTER are stored as (key, value) pairs and are accessible
-# through getheader()
-#
-# The VCF class can be instantiated with a 'regions' variable consisting of tuples (chrom,start,end) encoding
-# 0-based half-open segments.  Only variants with a position inside the segment will be parsed.  A regions
-# parser is available under parse_regions.
-#
-# When instantiated, a reference can be passed to the VCF class.  This may be any class that supports a
-# fetch(chrom, start, end) method.
-#
-#
-#
-# NOTE: the position that is returned to Python is 0-based, NOT 1-based as in the VCF file.
-#
-#
-#
-# TODO:
-#  only v4.0 writing is complete; alleles are not converted to v3.3 format
-#
-
-from collections import namedtuple, defaultdict
-from operator import itemgetter
-import sys, re, copy, bisect
-
-import pysam
-
-gtsRegEx = re.compile("[|/\\\\]")
-alleleRegEx = re.compile('^[ACGTN]+$')
-
-# Utility function.  Uses 0-based coordinates
-def get_sequence(chrom, start, end, fa):
-    # obtain sequence from .fa file, without truncation
-    if end<=start: return ""
-    if not fa: return "N"*(end-start)
-    if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper()
-    sequence = fa.fetch(chrom, start, end).upper()
-    if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence))
-    return sequence
-
-# Utility function.  Parses a region string
-def parse_regions( string ):
-    result = []
-    for r in string.split(','):
-        elts = r.split(':')
-        chrom, start, end = elts[0], 0, 3000000000
-        if len(elts)==1: pass
-        elif len(elts)==2:
-            if len(elts[1])>0:
-                ielts = elts[1].split('-')
-                if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r)
-                try:    start, end = int(ielts[0])-1, int(ielts[1])
-                except: raise ValueError("Don't understand region string '%s'" % r)
-        else:
-            raise ValueError("Don't understand region string '%s'" % r)
-        result.append( (chrom,start,end) )
-    return result
-            
-
-FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue')
-
-###########################################################################################################
-# 
-# New class
-# 
-###########################################################################################################
-
-class VCFRecord:
-    '''vcf record.
-
-    initialized from data and vcf meta 
-    '''
-    
-    data = None
-    vcf = None
-
-    def __init__(self, data, vcf):
-        self.data, self.vcf = data, vcf
-
-        if len(data) != len(self.vcf._samples):
-            self.error(str(data),
-                       self.BAD_NUMBER_OF_COLUMNS, 
-                       "expected %s for %s samples (%s), got %s" % \
-                           (len(self.vcf._samples), 
-                            len(self.vcf._samples), 
-                            self.vcf._samples, 
-                            len(data)))
-        
-    property contig:
-    def contig( self ): return self.data[0]
-
-    property pos:
-    def __get__( self ): 
-            return self.data.pos
-        
-    property id:
-        def __get__( self ): return self.data[2]
-
-    property ref:
-        def __get__(self ): 
-            # note: gerton substitutes reference if it can be fixed.
-            return self.data[3].upper()
-
-    property alt:
-        def __get__(self):
-            # convert v3.3 to v4.0 alleles below
-            alt = self.data[4] 
-            if alt == ".": alt = []
-            else: alt = alt.upper().split(',')
-            return alt
-
-    property qual:
-        def __get__(self):
-            qual = self.data[5]
-            if qual == ".": qual = -1
-            else: 
-                try:    qual = float(qual)
-                except: self.error(line,self.QUAL_NOT_NUMERICAL)
-
-    property filter:
-        def __get__(self):
-            # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
-            if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = []
-            else: filter = cols[6].split(';')
-
-            return filter
-
-    property info:
-        def __get__(self):
-            col = self.data[7]
-            # dictionary of keys, and list of values
-            info = {}
-            if col != ".":
-                for blurp in col.split(';'):
-                    elts = blurp.split('=')
-                    if len(elts) == 1: v = None
-                    elif len(elts) == 2: v = elts[1]
-                    else: self.error(str(self.data),self.ERROR_INFO_STRING)
-                    info[elts[0]] = self.parse_formatdata(elts[0], v, self.vcf._info, line)
-            return info
-
-    property format:
-         def __get__(self):
-             return self.data[8].split(':')
-
-    def __getitem__(self, key):
-        
-        # parse sample columns
-        values = self.data[self.vcf._sample2column[key]].split(':')
-        alt = self.alt
-        format = self.format
-
-        if len(values) > len(format):
-            self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format)))
-
-        result = {}
-        for idx in range(len(format)):
-            expected = self.vcf.get_expected(format[idx], self.vcf._format, alt)
-            if idx < len(values): value = values[idx]
-            else:
-                if expected == -1: value = "."
-                else: value = ",".join(["."]*expected)
-
-            result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, line)
-            if expected != -1 and len(result[format[idx]]) != expected:
-                self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS,
-                           "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]]))
-                if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]]))
-                result[format[idx]] = result[format[idx]][:expected]
-
-        return result
- 
-    def __str__(self):
-        return str(self.data)
-
-class VCF:
-
-    # types
-    NT_UNKNOWN = 0
-    NT_NUMBER = 1
-    NT_ALLELES = 2
-    NT_NR_ALLELES = 3
-    NT_GENOTYPES = 4
-    NT_PHASED_GENOTYPES = 5
-
-    _errors = { 0:"UNKNOWN_FORMAT_STRING:Unknown file format identifier",
-                1:"BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string",
-                2:"BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s",
-                3:"BAD_NUMBER_OF_COLUMNS:Wrong number of columns found (%s)",
-                4:"POS_NOT_NUMERICAL:Position column is not numerical",
-                5:"UNKNOWN_CHAR_IN_REF:Unknown character in reference field",
-                6:"V33_BAD_REF:Reference should be single-character in v3.3 VCF",
-                7:"V33_BAD_ALLELE:Cannot interpret allele for v3.3 VCF",
-                8:"POS_NOT_POSITIVE:Position field must be >0",
-                9:"QUAL_NOT_NUMERICAL:Quality field must be numerical, or '.'",
-               10:"ERROR_INFO_STRING:Error while parsing info field",
-               11:"ERROR_UNKNOWN_KEY:Unknown key (%s) found in formatted field (info; format; or filter)",
-               12:"ERROR_FORMAT_NOT_NUMERICAL:Expected integer or float in formatted field; got %s",
-               13:"ERROR_FORMAT_NOT_CHAR:Eexpected character in formatted field; got string",
-               14:"FILTER_NOT_DEFINED:Identifier (%s) in filter found which was not defined in header",
-               15:"FORMAT_NOT_DEFINED:Identifier (%s) in format found which was not defined in header",
-               16:"BAD_NUMBER_OF_VALUES:Found too many of values in sample column (%s)",
-               17:"BAD_NUMBER_OF_PARAMETERS:Found unexpected number of parameters (%s)",
-               18:"BAD_GENOTYPE:Cannot parse genotype (%s)",
-               19:"V40_BAD_ALLELE:Bad allele found for v4.0 VCF (%s)",
-               20:"MISSING_REF:Reference allele missing",
-               21:"V33_UNMATCHED_DELETION:Deleted sequence does not match reference (%s)",
-               22:"V40_MISSING_ANGLE_BRACKETS:Format definition is not deliminted by angular brackets",
-               23:"FORMAT_MISSING_QUOTES:Description field in format definition is not surrounded by quotes",
-               24:"V40_FORMAT_MUST_HAVE_NAMED_FIELDS:Fields in v4.0 VCF format definition must have named fields",
-               25:"HEADING_NOT_SEPARATED_BY_TABS:Heading line appears separated by spaces, not tabs",
-               26:"WRONG_REF:Wrong reference %s",
-               27:"ERROR_TRAILING_DATA:Numerical field ('%s') has semicolon-separated trailing data",
-               28:"BAD_CHR_TAG:Error calculating chr tag for %s",
-               29:"ZERO_LENGTH_ALLELE:Found zero-length allele",
-               30:"MISSING_INDEL_ALLELE_REF_BASE:Indel alleles must begin with single reference base"
-                }
-
-    # tag-value pairs; tags are not unique; does not include fileformat, INFO, FILTER or FORMAT fields
-    _header = []
-
-    # version number; 33=v3.3; 40=v4.0
-    _version = 40
-
-    # info, filter and format data
-    _info = {}
-    _filter = {}
-    _format = {}
-
-    # header; and required columns
-    _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"]
-    _samples = []
-
-    # control behaviour
-    _ignored_errors = set([11])   # ERROR_UNKNOWN_KEY
-    _warn_errors = set([])
-    _leftalign = False
-
-    # reference sequence
-    _reference = None
-
-    # regions to include; None includes everything
-    _regions = None
-
-    # statefull stuff
-    _lineno = -1
-    _line = None
-    _lines = None
-
-    def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False):
-        # make error identifiers accessible by name
-        for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id
-        if _copy != None:
-            self._leftalign = _copy._leftalign
-            self._header = _copy._header[:]
-            self._version = _copy._version
-            self._info = copy.deepcopy(_copy._info)
-            self._filter = copy.deepcopy(_copy._filter)
-            self._format = copy.deepcopy(_copy._format)
-            self._samples = _copy._samples[:]
-            self._sample2column = copy.deepcopy(_copy._sample2column)
-            self._ignored_errors = copy.deepcopy(_copy._ignored_errors)
-            self._warn_errors = copy.deepcopy(_copy._warn_errors)
-            self._reference = _copy._reference
-            self._regions = _copy._regions
-        if reference: self._reference = reference
-        if regions: self._regions = regions
-        if leftalign: self._leftalign = leftalign
-        self._lines = lines
-
-    def error(self,line,error,opt=None):
-        if error in self._ignored_errors: return
-        errorlabel, errorstring = self._errors[error].split(':')
-        if opt: errorstring = errorstring % opt
-        errwarn = ["Error","Warning"][error in self._warn_errors]
-        sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring))
-        if error in self._warn_errors: return
-        raise ValueError(errorstring)
-
-    def parse_format(self,line,format,filter=False):
-        if self._version >= 40:
-            if not format.startswith('<'): 
-                self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
-                format = "<"+format
-            if not format.endswith('>'): 
-                self.error(line,self.V40_MISSING_ANGLE_BRACKETS)
-                format += ">"
-            format = format[1:-1]
-        data = {'id':None,'number':None,'type':None,'descr':None}
-        idx = 0
-        while len(format.strip())>0:
-            elts = format.strip().split(',')
-            first, rest = elts[0], ','.join(elts[1:])
-            if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')):
-                if self._version >= 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS)
-                if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-                first = ["ID=","Number=","Type=","Description="][idx] + first
-            if first.startswith('ID='):            data['id'] = first.split('=')[1]
-            elif first.startswith('Number='):      data['number'] = first.split('=')[1]
-            elif first.startswith('Type='):        data['type'] = first.split('=')[1]
-            elif first.startswith('Description='):
-                elts = format.split('"')
-                if len(elts)<3: 
-                    self.error(line,self.FORMAT_MISSING_QUOTES)
-                    elts = first.split('=') + [rest] 
-                data['descr'] = elts[1]
-                rest = '"'.join(elts[2:])
-                if rest.startswith(','): rest = rest[1:]
-            else:
-                self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-            format = rest
-            idx += 1
-            if filter and idx==1: idx=3  # skip number and type fields for FILTER format strings
-        if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-        if not data['descr']: 
-            self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-            data['descr'] = '<none>'
-        if not data['type'] and not data['number']:
-            # fine, ##filter format
-            return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.')
-        if not data['type'] in ["Integer","Float","Character","String","Flag"]:
-            self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-        # I would like a missing-value field, but it isn't there
-        if data['type'] in ['Integer','Float']: data['missing'] = None    # Do NOT use arbitrary int/float as missing value
-        else:                                   data['missing'] = '.'
-        if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-        try:
-            n = int(data['number'])
-            t = self.NT_NUMBER
-        except ValueError:
-            n = -1
-            if data['number'] == '.':                   t = self.NT_UNKNOWN
-            elif data['number'] == '#alleles':          t = self.NT_ALLELES
-            elif data['number'] == '#nonref_alleles':   t = self.NT_NR_ALLELES
-            elif data['number'] == '#genotypes':        t = self.NT_GENOTYPES
-            elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES
-            else:
-                self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
-        return FORMAT(data['id'],t,n,data['type'],data['descr'],data['missing'])
-    
-
-    def format_format( self, fmt, filter=False ):
-        values = [('ID',fmt.id)]
-        if fmt.number != None and not filter:
-            if fmt.numbertype == self.NT_UNKNOWN: nmb = "."
-            elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number)
-            elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles"
-            elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles"
-            elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes"
-            elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes"
-            else:
-                raise ValueError("Unknown number type encountered: %s" % fmt.numbertype)
-            values.append( ('Number',nmb) )
-            values.append( ('Type', fmt.type) )
-        values.append( ('Description', '"' + fmt.description + '"') )
-        if self._version == 33:
-            format = ",".join(v for k,v in values)
-        else:
-            format = "<" + (",".join( "%s=%s" % (k,v) for (k,v) in values )) + ">"
-        return format
-
-    def get_expected(self, format, formatdict, alt):
-        fmt = formatdict[format]
-        if fmt.numbertype == self.NT_UNKNOWN: return -1
-        if fmt.numbertype == self.NT_NUMBER: return fmt.number
-        if fmt.numbertype == self.NT_ALLELES: return len(alt)+1
-        if fmt.numbertype == self.NT_NR_ALLELES: return len(alt)
-        if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2
-        if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1)
-        return 0
-
-
-    def _add_definition(self, formatdict, key, data, line ):
-        if key in formatdict: return
-        self.error(line,self.ERROR_UNKNOWN_KEY,key)
-        if data == None:
-            formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")
-            return
-        if data == []: data = [""]             # unsure what type -- say string
-        if type(data[0]) == type(0.0):
-            formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None)
-            return
-        if type(data[0]) == type(0):
-            formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None)
-            return
-        formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"String","(Undefined tag)",".")
-
-
-    # todo: trim trailing missing values
-    def format_formatdata( self, data, format, key=True, value=True, separator=":" ):
-        output, sdata = [], []
-        if type(data) == type([]): # for FORMAT field, make data with dummy values
-            d = {}
-            for k in data: d[k] = []
-            data = d
-        # convert missing values; and silently add definitions if required
-        for k in data:
-            self._add_definition( format, k, data[k], "(output)" )
-            for idx,v in enumerate(data[k]):
-                if v == format[k].missingvalue: data[k][idx] = "."
-        # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string
-        for k in data: 
-            if k != 'GT': sdata.append( (k,data[k]) )
-        sdata.sort()
-        if 'GT' in data:
-            sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata
-        for k,v in sdata:
-            if v == []: v = None
-            if key and value:
-                if v != None: output.append( k+"="+','.join(map(str,v)) )
-                else: output.append( k )
-            elif key: output.append(k)
-            elif value:
-                if v != None: output.append( ','.join(map(str,v)) )
-                else: output.append( "." )                    # should not happen
-        # snip off trailing missing data
-        while len(output) > 1:
-            last = output[-1].replace(',','').replace('.','')
-            if len(last)>0: break
-            output = output[:-1]
-        return separator.join(output)
-
-
-    def enter_default_format(self):
-        for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'),
-                  FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1),
-                  FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1),
-                  FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1),    # unknown number, since may be haploid
-                  FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]:
-            if f.id not in self._format:
-                self._format[f.id] = f
-
-    def parse_header( self, line ):
-        assert line.startswith('##')
-        elts = line[2:].split('=')
-        key = elts[0].strip()
-        value = '='.join(elts[1:]).strip()
-        if key == "fileformat":
-            if value == "VCFv3.3":
-                self._version = 33
-            elif value == "VCFv4.0":
-                self._version = 40
-            elif value == "VCFv4.1":
-                self._version = 41
-            else:
-                self.error(line,self.UNKNOWN_FORMAT_STRING)
-        elif key == "INFO":
-            f = self.parse_format(line, value)
-            self._info[ f.id ] = f
-        elif key == "FILTER":
-            f = self.parse_format(line, value, filter=True)
-            self._filter[ f.id ] = f
-        elif key == "FORMAT":
-            f = self.parse_format(line, value)
-            self._format[ f.id ] = f
-        else:
-            # keep other keys in the header field
-            self._header.append( (key,value) )
-
-
-    def write_header( self, stream ):
-        stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10))
-        for key,value in self._header: stream.write("##%s=%s\n" % (key,value))
-        for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]:
-            for f in var.itervalues(): stream.write("##%s=%s\n" % (label,self.format_format(f,filter=(label=="FILTER"))))
-        
-
-    def parse_heading( self, line ):
-        assert line.startswith('#')
-        assert not line.startswith('##')
-        headings = line[1:].split('\t')
-        if len(headings)==1 and len(line[1:].split()) >= 9:
-            self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS)
-            headings = line[1:].split()
-
-        for i,s in enumerate(self._required):
-
-            if len(headings)<=i or headings[i] != s:
-
-                if len(headings) <= i: 
-                    err = "(%sth entry not found)" % (i+1)
-                else:
-                    err = "(found %s, expected %s)" % (headings[i],s)
-
-                #self.error(line,self.BADLY_FORMATTED_HEADING,err)
-
-                # allow FORMAT column to be absent
-                if len(headings) == 8:
-                    headings.append("FORMAT")
-                else:
-                    self.error(line,self.BADLY_FORMATTED_HEADING,err)
-
-        self._samples = headings[9:]
-        self._sample2column = dict( [(y,x) for x,y in enumerate( self._samples ) ] )
-                           
-    def write_heading( self, stream ):
-        stream.write("#" + "\t".join(self._required + self._samples) + "\n")
-
-    def convertGT(self, GTstring):
-        if GTstring == ".": return ["."]
-        try:
-            gts = gtsRegEx.split(GTstring)
-            if len(gts) == 1: return [int(gts[0])]
-            if len(gts) != 2: raise ValueError()
-            if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]]
-            return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]
-        except ValueError:
-            self.error(self._line,self.BAD_GENOTYPE,GTstring)
-            return [".","|","."]
-
-
-    def convertGTback(self, GTdata):
-        return ''.join(map(str,GTdata))
-
-    def parse_formatdata( self, key, value, formatdict, line ):
-        # To do: check that the right number of values is present
-        f = formatdict.get(key,None)
-        if f == None:
-            self._add_definition(formatdict, key, value, line )
-            f = formatdict[key]
-        if f.type == "Flag":
-            if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE)
-            return []
-        values = value.split(',')
-        # deal with trailing data in some early VCF files
-        if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:
-            self.error(line,self.ERROR_TRAILING_DATA,values[-1])
-            values[-1] = values[-1].split(';')[0]
-        if f.type == "Integer": 
-            for idx,v in enumerate(values):
-                try:
-                    if v == ".": values[idx] = f.missingvalue
-                    else:        values[idx] = int(v)
-                except: 
-                    self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)
-                    return [0] * len(values)
-            return values
-        elif f.type == "String":
-            self._line = line
-            if f.id == "GT": values = map( self.convertGT, values )
-            return values
-        elif f.type == "Character":
-            for v in values: 
-                if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)
-            return values
-        elif f.type == "Float":
-            for idx,v in enumerate(values):
-                if v == ".": values[idx] = f.missingvalue
-            try: return map(float,values)
-            except:
-                self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values)
-                return [0.0] * len(values)
-        else:
-            # can't happen
-            self.error(line,self.ERROR_INFO_STRING)
-
-
-    def inregion(self, chrom, pos):
-        if not self._regions: return True
-        for r in self._regions:
-            if r[0] == chrom and r[1] <= pos < r[2]: return True
-        return False
-        
-
-    def parse_data( self, line, lineparse=False ):
-        cols = line.split('\t')
-        if len(cols) != len(self._samples)+9:
-            # gracefully deal with absent FORMAT column
-            if len(cols) == 8 and len(self._samples)==0:
-                cols.append("")
-            else:
-                self.error(line,
-                           self.BAD_NUMBER_OF_COLUMNS, 
-                           "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols)))
-
-        chrom = cols[0]
-
-        # get 0-based position
-        try:    pos = int(cols[1])-1
-        except: self.error(line,self.POS_NOT_NUMERICAL)
-        if pos < 0: self.error(line,self.POS_NOT_POSITIVE)
-
-        # implement filtering
-        if not self.inregion(chrom,pos): return None
-
-        # end of first-pass parse for sortedVCF
-        if lineparse: return chrom, pos, line
-        
-        id = cols[2]
-
-        ref = cols[3].upper()
-        if ref == ".":
-            self.error(line,self.MISSING_REF)
-            if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
-            else:                   ref = ""
-        else:
-            for c in ref:
-                if c not in "ACGTN": self.error(line,self.UNKNOWN_CHAR_IN_REF)
-            if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference)
-
-        # make sure reference is sane
-        if self._reference:
-            left = max(0,pos-100)
-            faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference)
-            faref = faref_leftflank[pos-left:]
-            if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
-            ref = faref
-
-        # convert v3.3 to v4.0 alleles below
-        if cols[4] == ".": alt = []
-        else: alt = cols[4].upper().split(',')
-
-        if cols[5] == ".": qual = -1
-        else: 
-            try:    qual = float(cols[5])
-            except: self.error(line,self.QUAL_NOT_NUMERICAL)
-
-        # postpone checking that filters exist.  Encode missing filter or no filtering as empty list
-        if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = []
-        else: filter = cols[6].split(';')
-
-        # dictionary of keys, and list of values
-        info = {}
-        if cols[7] != ".":
-            for blurp in cols[7].split(';'):
-                elts = blurp.split('=')
-                if len(elts) == 1: v = None
-                elif len(elts) == 2: v = elts[1]
-                else: self.error(line,self.ERROR_INFO_STRING)
-                info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line)
-
-        # Gracefully deal with absent FORMAT column
-        if cols[8] == "": format = []
-        else: format = cols[8].split(':')
-
-        # check: all filters are defined
-        for f in filter:
-            if f not in self._filter: self.error(line,self.FILTER_NOT_DEFINED, f)
-            
-        # check: format fields are defined
-        for f in format:
-            if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f)
-
-        # convert v3.3 alleles
-        if self._version == 33:
-            if len(ref) != 1: self.error(line,self.V33_BAD_REF)
-            newalts = []
-            have_deletions = False
-            for a in alt:
-                if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
-                elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
-                elif a.startswith('D'): # allow D<seq> and D<num>
-                    have_deletions = True
-                    try:
-                        l = int(a[1:])          # throws ValueError if sequence
-                        if len(ref) < l:        # add to reference if necessary
-                            addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
-                            ref += addns
-                            for i,na in enumerate(newalts): newalts[i] = na+addns
-                        a = ref[l:]             # new deletion, deleting pos...pos+l
-                    except ValueError:
-                        s = a[1:]
-                        if len(ref) < len(s):   # add Ns to reference if necessary
-                            addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
-                            if not s.endswith(addns) and addns != 'N'*len(addns):
-                                self.error(line,self.V33_UNMATCHED_DELETION,
-                                           "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
-                            ref += addns
-                            for i,na in enumerate(newalts): newalts[i] = na+addns
-                        a = ref[len(s):]        # new deletion, deleting from pos
-                else:
-                    self.error(line,self.V33_BAD_ALLELE)
-                newalts.append(a)
-            alt = newalts
-            # deletion alleles exist, add dummy 1st reference allele, and account for leading base
-            if have_deletions:
-                if pos == 0:
-                    # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
-                    addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
-                    ref += addn
-                    alt = [allele+addn for allele in alt]
-                else:
-                    addn = get_sequence(chrom,pos-1,pos,self._reference)
-                    ref = addn + ref
-                    alt = [addn + allele for allele in alt]
-                    pos -= 1
-        else:
-            # format v4.0 -- just check for nucleotides
-            for allele in alt:
-                if not alleleRegEx.match(allele):
-                    self.error(line,self.V40_BAD_ALLELE,allele)
-
-        # check for leading nucleotide in indel calls
-        for allele in alt:
-            if len(allele) != len(ref):
-                if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
-                if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():
-                    self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE)
-
-        # trim trailing bases in alleles
-        for i in range(1,min(len(ref),min(map(len,alt)))):
-            if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
-                break
-            ref, alt = ref[:-1], [allele[:-1] for allele in alt]
-
-        # left-align alleles, if a reference is available
-        if self._leftalign and self._reference:
-            while left < pos:
-                movable = True
-                for allele in alt:
-                    if len(allele) > len(ref):
-                        longest, shortest = allele, ref
-                    else:
-                        longest, shortest = ref, allele
-                    if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
-                        movable = False
-                    if longest[-1].upper() != longest[len(shortest)-1].upper():
-                        movable = False
-                if not movable:
-                    break
-                ref = ref[:-1]
-                alt = [allele[:-1] for allele in alt]
-                if min(len(allele) for allele in alt) == 0 or len(ref) == 0:
-                    ref = faref_leftflank[pos-left-1] + ref
-                    alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
-                    pos -= 1
-
-        # parse sample columns
-        samples = []
-        for sample in cols[9:]:
-            dict = {}
-            values = sample.split(':')
-            if len(values) > len(format):
-                self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format)))
-            for idx in range(len(format)):
-                expected = self.get_expected(format[idx], self._format, alt)
-                if idx < len(values): value = values[idx]
-                else:
-                    if expected == -1: value = "."
-                    else: value = ",".join(["."]*expected)
-                dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line)
-                if expected != -1 and len(dict[format[idx]]) != expected:
-                    self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
-                               "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]]))
-                    if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]]))
-                    dict[format[idx]] = dict[format[idx]][:expected]
-            samples.append( dict )
-
-        # done
-        d = {'chrom':chrom,
-             'pos':pos,      # return 0-based position
-             'id':id,
-             'ref':ref,
-             'alt':alt,
-             'qual':qual,
-             'filter':filter,
-             'info':info,
-             'format':format}
-        for key,value in zip(self._samples,samples):
-            d[key] = value
-        
-        return d
-
-
-    def write_data(self, stream, data):
-        required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples
-        for k in required:
-            if k not in data: raise ValueError("Required key %s not found in data" % str(k))
-        if data['alt'] == []: alt = "."
-        else: alt = ",".join(data['alt'])
-        if data['filter'] == None: filter = "."
-        elif data['filter'] == []: 
-            if self._version == 33: filter = "0"
-            else: filter = "PASS"
-        else: filter = ';'.join(data['filter'])
-        if data['qual'] == -1: qual = "."
-        else: qual = str(data['qual'])
-
-        output = [data['chrom'], 
-                  str(data['pos']+1),   # change to 1-based position
-                  data['id'],
-                  data['ref'],
-                  alt,
-                  qual,
-                  filter,
-                  self.format_formatdata( data['info'], self._info, separator=";" ),
-                  self.format_formatdata( data['format'], self._format, value=False ) ]
-        
-        for s in self._samples:
-            output.append( self.format_formatdata( data[s], self._format, key=False ) )
-        
-        stream.write( "\t".join(output) + "\n" )
-
-    def _parse_header(self, stream):
-        self._lineno = 0
-        for line in stream:
-            self._lineno += 1
-            if line.startswith('##'):
-                self.parse_header( line.strip() )
-            elif line.startswith('#'):
-                self.parse_heading( line.strip() )
-                self.enter_default_format()
-            else:
-                break
-        return line
-
-    def _parse(self, line, stream):
-        if len(line.strip()) > 0:
-            d = self.parse_data( line.strip() )
-            if d: yield d
-        for line in stream:
-            self._lineno += 1
-            if self._lines and self._lineno > self._lines: raise StopIteration
-            d = self.parse_data( line.strip() )
-            if d: yield d
-
-    ######################################################################################################
-    #
-    # API follows
-    #
-    ######################################################################################################
-
-    def getsamples(self):
-        """ List of samples in VCF file """
-        return self._samples
-
-    def setsamples(self,samples):
-        """ List of samples in VCF file """
-        self._samples = samples
-
-    def getheader(self):
-        """ List of header key-value pairs (strings) """
-        return self._header
-
-    def setheader(self,header):
-        """ List of header key-value pairs (strings) """
-        self._header = header
-
-    def getinfo(self):
-        """ Dictionary of ##INFO tags, as VCF.FORMAT values """
-        return self._info
-
-    def setinfo(self,info):
-        """ Dictionary of ##INFO tags, as VCF.FORMAT values """
-        self._info = info
-
-    def getformat(self):
-        """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
-        return self._format
-
-    def setformat(self,format):
-        """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """
-        self._format = format
-
-    def getfilter(self):
-        """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
-        return self._filter
-
-    def setfilter(self,filter):
-        """ Dictionary of ##FILTER tags, as VCF.FORMAT values """
-        self._filter = filter
-
-    def setversion(self, version):
-        if version not in [33,40,41]: raise ValueError("Can only handle v3.3, v4.0 and v4.1 VCF files")
-        self._version = version
-
-    def setregions(self, regions):
-        self._regions = regions
-
-    def setreference(self, ref):
-        """ Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile """
-        self._reference = ref
-
-    def ignoreerror(self, errorstring):
-        try:             self._ignored_errors.add(self.__dict__[errorstring])
-        except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
-
-    def warnerror(self, errorstring):
-        try:             self._warn_errors.add(self.__dict__[errorstring])
-        except KeyError: raise ValueError("Invalid error string: %s" % errorstring)
-
-    def parse(self, stream):
-        """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
-        last_line = self._parse_header(stream)
-        # now return a generator that does the actual work.  In this way the pre-processing is done
-        # before the first piece of data is yielded
-        return self._parse(last_line, stream)
-
-    def write(self, stream, datagenerator):
-        """ Writes a VCF file to a stream, using a data generator (or list) """
-        self.write_header(stream)
-        self.write_heading(stream)
-        for data in datagenerator: self.write_data(stream,data)
-
-    def writeheader(self, stream):
-        """ Writes a VCF header """
-        self.write_header(stream)
-        self.write_heading(stream)
-
-    def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2):
-        """ Utility function: compares two calls for equality """
-        # a variant should always be assigned to a unique position, one base before
-        # the leftmost position of the alignment gap.  If this rule is implemented
-        # correctly, the two positions must be equal for the calls to be identical.
-        if pos1 != pos2: return False
-        # from both calls, trim rightmost bases when identical.  Do this safely, i.e.
-        # only when the reference bases are not Ns
-        while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]:
-            ref1 = ref1[:-1]
-            alt1 = alt1[:-1]
-        while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]:
-            ref2 = ref2[:-1]
-            alt2 = alt2[:-1]
-        # now, the alternative alleles must be identical
-        return alt1 == alt2
-
-###########################################################################################################
-###########################################################################################################
-## API functions added by Andreas
-###########################################################################################################
-
-    def connect( self, filename ):
-        '''connect to tabix file.'''
-        self.tabixfile = pysam.Tabixfile( filename )
-        self._parse_header(self.tabixfile.header)
-        
-    def fetch(self,
-              reference = None,
-              start = None, 
-              end = None, 
-              region = None ):
-        """ Parse a stream of VCF-formatted lines.  Initializes class instance and return generator """
-
-        iter = self.tabixfile.fetch( reference, start, end, region, parser = pysam.asVCF() )
-        for x in iter:
-            yield VCFRecord( x, self )
-
-    def validate( self, record ):
-        '''validate vcf record.
-
-        returns a validated record.
-        '''
-
-        chrom, pos = record.chrom, record.pos
-
-        # check reference
-        ref = record.ref
-        if ref == ".":
-            self.error(str(record),self.MISSING_REF)
-            if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
-            else:                   ref = ""
-        else:
-            for c in ref:
-                if c not in "ACGTN": self.error(str(record),self.UNKNOWN_CHAR_IN_REF)
-                if "N" in ref: ref = get_sequence(chrom,
-                                                  pos,
-                                                  pos+len(ref),
-                                                  self._reference)
-
-        # make sure reference is sane
-        if self._reference:
-            left = max(0,self.pos-100)
-            faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference)
-            faref = faref_leftflank[pos-left:]
-            if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
-            ref = faref
-            
-        # check: format fields are defined
-        for f in record.format:
-            if f not in self._format: self.error(str(record),self.FORMAT_NOT_DEFINED, f)
-            
-        # check: all filters are defined
-        for f in record.filter:
-            if f not in self._filter: self.error(str(record),self.FILTER_NOT_DEFINED, f)
-
-        # convert v3.3 alleles
-        if self._version == 33:
-            if len(ref) != 1: self.error(line,self.V33_BAD_REF)
-            newalts = []
-            have_deletions = False
-            for a in alt:
-                if len(a) == 1: a = a + ref[1:]                       # SNP; add trailing reference
-                elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
-                elif a.startswith('D'): # allow D<seq> and D<num>
-                    have_deletions = True
-                    try:
-                        l = int(a[1:])          # throws ValueError if sequence
-                        if len(ref) < l:        # add to reference if necessary
-                            addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
-                            ref += addns
-                            for i,na in enumerate(newalts): newalts[i] = na+addns
-                        a = ref[l:]             # new deletion, deleting pos...pos+l
-                    except ValueError:
-                        s = a[1:]
-                        if len(ref) < len(s):   # add Ns to reference if necessary
-                            addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
-                            if not s.endswith(addns) and addns != 'N'*len(addns):
-                                self.error(line,self.V33_UNMATCHED_DELETION,
-                                           "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
-                            ref += addns
-                            for i,na in enumerate(newalts): newalts[i] = na+addns
-                        a = ref[len(s):]        # new deletion, deleting from pos
-                else:
-                    self.error(line,self.V33_BAD_ALLELE)
-                newalts.append(a)
-            alt = newalts
-            # deletion alleles exist, add dummy 1st reference allele, and account for leading base
-            if have_deletions:
-                if pos == 0:
-                    # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
-                    addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
-                    ref += addn
-                    alt = [allele+addn for allele in alt]
-                else:
-                    addn = get_sequence(chrom,pos-1,pos,self._reference)
-                    ref = addn + ref
-                    alt = [addn + allele for allele in alt]
-                    pos -= 1
-        else:
-            # format v4.0 -- just check for nucleotides
-            for allele in alt:
-                if not alleleRegEx.match(allele):
-                    self.error(line,self.V40_BAD_ALLELE,allele)
-                    
-
-        # check for leading nucleotide in indel calls
-        for allele in alt:
-            if len(allele) != len(ref):
-                if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
-                if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper():
-                    self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE)
-
-        # trim trailing bases in alleles
-        for i in range(1,min(len(ref),min(map(len,alt)))):
-            if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
-                break
-            ref, alt = ref[:-1], [allele[:-1] for allele in alt]
-
-        # left-align alleles, if a reference is available
-        if self._leftalign and self._reference:
-            while left < pos:
-                movable = True
-                for allele in alt:
-                    if len(allele) > len(ref):
-                        longest, shortest = allele, ref
-                    else:
-                        longest, shortest = ref, allele
-                    if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
-                        movable = False
-                    if longest[-1].upper() != longest[len(shortest)-1].upper():
-                        movable = False
-                if not movable:
-                    break
-                ref = ref[:-1]
-                alt = [allele[:-1] for allele in alt]
-                if min(len(allele) for allele in alt) == 0 or len(ref) == 0:
-                    ref = faref_leftflank[pos-left-1] + ref
-                    alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
-                    pos -= 1
-
-
-
-
diff --git a/pysam/__init__.py b/pysam/__init__.py
index f4f1138..7c001d1 100644
--- a/pysam/__init__.py
+++ b/pysam/__init__.py
@@ -113,7 +113,7 @@ SAMTOOLS_DISPATCH = {
  }
 
 # instantiate samtools commands as python functions
-for key, options in SAMTOOLS_DISPATCH.iteritems():
+for key, options in SAMTOOLS_DISPATCH.items():
     cmd, parser = options
     globals()[key] = SamtoolsDispatcher(cmd, parser)
 
diff --git a/pysam/csamtools.c b/pysam/csamtools.c
index b7495db..35b4522 100644
--- a/pysam/csamtools.c
+++ b/pysam/csamtools.c
@@ -1,12 +1,11 @@
-/* Generated by Cython 0.16 on Thu Nov 22 15:20:54 2012 */
+/* Generated by Cython 0.15.1 on Mon Jan 14 23:52:53 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
-#elif PY_VERSION_HEX < 0x02040000
-    #error Cython requires Python 2.4+.
 #else
+
 #include <stddef.h> /* For offsetof */
 #ifndef offsetof
 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
@@ -35,22 +34,10 @@
   #define PY_LONG_LONG LONG_LONG
 #endif
 
-#ifndef Py_HUGE_VAL
-  #define Py_HUGE_VAL HUGE_VAL
-#endif
-
-#ifdef PYPY_VERSION
-#define CYTHON_COMPILING_IN_PYPY 1
-#define CYTHON_COMPILING_IN_CPYTHON 0
-#else
-#define CYTHON_COMPILING_IN_PYPY 0
-#define CYTHON_COMPILING_IN_CPYTHON 1
-#endif
-
-#if CYTHON_COMPILING_IN_PYPY
-  #define __Pyx_PyCFunction_Call PyObject_Call
-#else
-  #define __Pyx_PyCFunction_Call PyCFunction_Call
+#if PY_VERSION_HEX < 0x02040000
+  #define METH_COEXIST 0
+  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
+  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
 #endif
 
 #if PY_VERSION_HEX < 0x02050000
@@ -63,9 +50,6 @@
   #define PyNumber_Index(o)    PyNumber_Int(o)
   #define PyIndex_Check(o)     PyNumber_Check(o)
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
-  #define __PYX_BUILD_PY_SSIZE_T "i"
-#else
-  #define __PYX_BUILD_PY_SSIZE_T "n"
 #endif
 
 #if PY_VERSION_HEX < 0x02060000
@@ -99,25 +83,13 @@
   #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
   #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
   #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
-  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
-  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
 
-  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
-  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
 #endif
 
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
-  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
-          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
 #else
   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
-  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
-          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
-#endif
-
-#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
-  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
 #endif
 
 #if PY_MAJOR_VERSION >= 3
@@ -129,17 +101,6 @@
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
 
-
-#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
-  #define CYTHON_PEP393_ENABLED 1
-  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
-  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
-#else
-  #define CYTHON_PEP393_ENABLED 0
-  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
-  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
-#endif
-
 #if PY_MAJOR_VERSION >= 3
   #define PyBaseString_Type            PyUnicode_Type
   #define PyStringObject               PyUnicodeObject
@@ -207,6 +168,15 @@
   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
 #endif
 
+
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
+  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
+#else
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
+  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
+#endif
+
 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
   #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
   #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
@@ -248,14 +218,6 @@
   #define __Pyx_DOCSTR(n)  (n)
 #endif
 
-#if PY_MAJOR_VERSION >= 3
-  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
-  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
-#else
-  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
-  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
-#endif
-
 #ifndef __PYX_EXTERN_C
   #ifdef __cplusplus
     #define __PYX_EXTERN_C extern "C"
@@ -313,7 +275,7 @@
 #   else
 #     define CYTHON_UNUSED
 #   endif
-# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# elif defined(__ICC) || defined(__INTEL_COMPILER)
 #   define CYTHON_UNUSED __attribute__ ((__unused__))
 # else
 #   define CYTHON_UNUSED
@@ -338,7 +300,7 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
-#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -370,7 +332,15 @@ static const char *__pyx_f[] = {
   "complex.pxd",
 };
 
+static PyObject *__Pyx_Generator_Next(PyObject *self);
+static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
+static PyObject *__Pyx_Generator_Close(PyObject *self);
+static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args, CYTHON_UNUSED PyObject *kwds);
+
+typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
+
 /*--- Type declarations ---*/
+struct __pyx_Generator_object;
 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr;
 struct __pyx_obj_9csamtools_IteratorRow;
 struct __pyx_obj_9csamtools_IteratorRowAllRefs;
@@ -442,8 +412,18 @@ struct __pyx_t_9csamtools_MateData {
  * else:
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
  */
-struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr {
+struct __pyx_Generator_object {
   PyObject_HEAD
+  __pyx_generator_body_t body;
+  int is_running;
+  int resume_label;
+  PyObject *exc_type;
+  PyObject *exc_value;
+  PyObject *exc_traceback;
+};
+
+struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr {
+  struct __pyx_Generator_object __pyx_base;
   PyObject *__pyx_v_x;
   PyObject *__pyx_v_y;
   PyObject *__pyx_t_0;
@@ -621,7 +601,7 @@ struct __pyx_obj_9csamtools_IteratorRowRegion {
  * 
  */
 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr {
-  PyObject_HEAD
+  struct __pyx_Generator_object __pyx_base;
   PyObject *__pyx_v_x;
   PyObject *__pyx_v_y;
   PyObject *__pyx_t_0;
@@ -844,9 +824,11 @@ struct __pyx_vtabstruct_9csamtools_IteratorRowAll {
   int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowAll *);
 };
 static struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtabptr_9csamtools_IteratorRowAll;
+
 #ifndef CYTHON_REFNANNY
   #define CYTHON_REFNANNY 0
 #endif
+
 #if CYTHON_REFNANNY
   typedef struct {
     void (*INCREF)(void*, PyObject*, int);
@@ -859,21 +841,8 @@ static struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtabptr_9csamtoo
   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
-#ifdef WITH_THREAD
-  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
-          if (acquire_gil) { \
-              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
-              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
-              PyGILState_Release(__pyx_gilstate_save); \
-          } else { \
-              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
-          }
-#else
-  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
-          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
-#endif
-  #define __Pyx_RefNannyFinishContext() \
-          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
@@ -884,7 +853,7 @@ static struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtabptr_9csamtoo
   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
 #else
   #define __Pyx_RefNannyDeclarations
-  #define __Pyx_RefNannySetupContext(name, acquire_gil)
+  #define __Pyx_RefNannySetupContext(name)
   #define __Pyx_RefNannyFinishContext()
   #define __Pyx_INCREF(r) Py_INCREF(r)
   #define __Pyx_DECREF(r) Py_DECREF(r)
@@ -895,21 +864,23 @@ static struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtabptr_9csamtoo
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
-#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
-#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
 #ifndef CYTHON_PROFILE
   #define CYTHON_PROFILE 1
 #endif
+
 #ifndef CYTHON_PROFILE_REUSE_FRAME
   #define CYTHON_PROFILE_REUSE_FRAME 0
 #endif
+
 #if CYTHON_PROFILE
+
   #include "compile.h"
   #include "frameobject.h"
   #include "traceback.h"
+
   #if CYTHON_PROFILE_REUSE_FRAME
     #define CYTHON_FRAME_MODIFIER static
     #define CYTHON_FRAME_DEL
@@ -917,14 +888,17 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
     #define CYTHON_FRAME_MODIFIER
     #define CYTHON_FRAME_DEL Py_DECREF(__pyx_frame)
   #endif
+
   #define __Pyx_TraceDeclarations                                  \
   static PyCodeObject *__pyx_frame_code = NULL;                      \
   CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;           \
   int __Pyx_use_tracing = 0;
+
   #define __Pyx_TraceCall(funcname, srcfile, firstlineno)                            \
   if (unlikely(PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc)) {      \
       __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, funcname, srcfile, firstlineno);  \
   }
+
   #define __Pyx_TraceException()                                                           \
   if (unlikely(__Pyx_use_tracing( && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {  \
       PyObject *exc_info = __Pyx_GetExceptionTuple();                                      \
@@ -934,19 +908,24 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
           Py_DECREF(exc_info);                                                             \
       }                                                                                    \
   }
+
   #define __Pyx_TraceReturn(result)                                                  \
   if (unlikely(__Pyx_use_tracing) && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {  \
       PyThreadState_GET()->c_profilefunc(                                            \
           PyThreadState_GET()->c_profileobj, __pyx_frame, PyTrace_RETURN, (PyObject*)result);     \
       CYTHON_FRAME_DEL;                                                               \
   }
+
   static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno); /*proto*/
   static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, const char *funcname, const char *srcfile, int firstlineno); /*proto*/
+
 #else
+
   #define __Pyx_TraceDeclarations
   #define __Pyx_TraceCall(funcname, srcfile, firstlineno)
   #define __Pyx_TraceException()
   #define __Pyx_TraceReturn(result)
+
 #endif /* CYTHON_PROFILE */
 
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
@@ -963,13 +942,13 @@ static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) {
 
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
-static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/
+static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
+    const char* function_name, int kw_allowed); /*proto*/
 
-static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name, PyObject* kw_name); /*proto*/
 
-static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
-    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
-    const char* function_name); /*proto*/
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
 
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
@@ -979,6 +958,7 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
+
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
     PyObject *r;
     if (!j) return NULL;
@@ -986,9 +966,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j
     Py_DECREF(j);
     return r;
 }
+
+
 #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_GetItemInt_List_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
     if (likely(o != Py_None)) {
         if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
@@ -1004,9 +987,11 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
+
 #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
     if (likely(o != Py_None)) {
         if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
@@ -1022,33 +1007,29 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
+
+
 #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_GetItemInt_Fast(o, i) : \
                                                     __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
+    PyObject *r;
+    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
     }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
+    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
     }
-    else if (likely(i >= 0)) {
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            return m->sq_item(o, i);
-        }
+    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
+        r = PySequence_GetItem(o, i);
     }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+    else {
+        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+    }
+    return r;
 }
 
 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
@@ -1073,8 +1054,8 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
-static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) {
-    return unlikely(b < 0) ? b : !b;
+static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
+    return unlikely(b < 0) ? b : !b; 
 }
 static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
     return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
@@ -1114,6 +1095,7 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec
     Py_INCREF(value);
 #else
     if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
+        /* these presumably have safe hash functions */
         value = PyDict_GetItem(d, key);
         if (unlikely(!value)) {
             value = default_value;
@@ -1124,7 +1106,7 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec
         m = __Pyx_GetAttrString(d, "get");
         if (!m) return NULL;
         value = PyObject_CallFunctionObjArgs(m, key,
-                                             (default_value == Py_None) ? NULL : default_value, NULL);
+            (default_value == Py_None) ? NULL : default_value, NULL);
         Py_DECREF(m);
     }
 #endif
@@ -1140,6 +1122,7 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
 #define __Pyx_DelItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_DelItemInt_Fast(o, i) : \
                                                     __Pyx_DelItem_Generic(o, to_py_func(i)))
+
 static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
     int r;
     if (!j) return -1;
@@ -1147,14 +1130,14 @@ static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
     Py_DECREF(j);
     return r;
 }
+
 static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i) {
-    if (likely(i >= 0)) {
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_ass_item)) {
-            return m->sq_ass_item(o, i, (PyObject *)NULL);
-        }
+    if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && likely(i >= 0))
+        return PySequence_DelItem(o, i);
+    else {
+        PyObject *j = PyInt_FromSsize_t(i);
+        return __Pyx_DelItem_Generic(o, j);
     }
-    return __Pyx_DelItem_Generic(o, PyInt_FromSsize_t(i));
 }
 
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
@@ -1167,47 +1150,19 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                    PyObject *modname); /*proto*/
 
-#define __Pyx_CyFunction_USED 1
-#include <structmember.h>
-#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
-#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
-#define __Pyx_CYFUNCTION_CCLASS        0x04
-#define __Pyx_CyFunction_GetClosure(f) \
-    (((__pyx_CyFunctionObject *) (f))->func_closure)
-#define __Pyx_CyFunction_GetClassObj(f) \
-    (((__pyx_CyFunctionObject *) (f))->func_classobj)
-#define __Pyx_CyFunction_Defaults(type, f) \
-    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
-#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
-    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
+#define __pyx_binding_PyCFunctionType_USED 1
+
 typedef struct {
     PyCFunctionObject func;
-    int flags;
-    PyObject *func_dict;
-    PyObject *func_weakreflist;
-    PyObject *func_name;
-    PyObject *func_doc;
-    PyObject *func_code;
-    PyObject *func_closure;
-    PyObject *func_classobj; /* No-args super() class cell */
-    void *defaults;
-    int defaults_pyobjects;
-    PyObject *defaults_tuple; /* Const defaults tuple */
-    PyObject *(*defaults_getter)(PyObject *);
-} __pyx_CyFunctionObject;
-static PyTypeObject *__pyx_CyFunctionType = 0;
-#define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \
-    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code)
-static PyObject *__Pyx_CyFunction_New(PyTypeObject *,
-                                      PyMethodDef *ml, int flags,
-                                      PyObject *self, PyObject *module,
-                                      PyObject* code);
-static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
-                                                         size_t size,
-                                                         int pyobjects);
-static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
-                                                            PyObject *tuple);
-static int __Pyx_CyFunction_init(void);
+} __pyx_binding_PyCFunctionType_object;
+
+static PyTypeObject __pyx_binding_PyCFunctionType_type;
+static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;
+
+static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
+#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)
+
+static int __pyx_binding_PyCFunctionType_init(void); /* proto */
 
 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
@@ -1277,25 +1232,6 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *
 
 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
-#define __Pyx_Generator_USED
-#include <structmember.h>
-typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
-typedef struct {
-    PyObject_HEAD
-    __pyx_generator_body_t body;
-    PyObject *closure;
-    int is_running;
-    int resume_label;
-    PyObject *exc_type;
-    PyObject *exc_value;
-    PyObject *exc_traceback;
-    PyObject *gi_weakreflist;
-    PyObject *classobj;
-} __pyx_GeneratorObject;
-static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
-                                                  PyObject *closure);
-static int __pyx_Generator_init(void);
-
 static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                   int lineno, const char *filename); /*proto*/
 
@@ -1303,38 +1239,15 @@ static int __Pyx_check_binary_version(void);
 
 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
 
-#if !defined(__Pyx_PyIdentifier_FromString)
-#if PY_MAJOR_VERSION < 3
-  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
-#else
-  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
-#endif
-#endif
-
 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/
 
 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
 
-typedef struct {
-    int code_line;
-    PyCodeObject* code_object;
-} __Pyx_CodeObjectCacheEntry;
-struct __Pyx_CodeObjectCache {
-    int count;
-    int max_count;
-    __Pyx_CodeObjectCacheEntry* entries;
-};
-static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
-static PyCodeObject *__pyx_find_code_object(int code_line);
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
-
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
-                               int py_line, const char *filename); /*proto*/
+static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
+                               int __pyx_lineno, const char *__pyx_filename); /*proto*/
 
 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
-
 /* Module declarations from 'cpython.version' */
 
 /* Module declarations from 'cpython.ref' */
@@ -1429,6 +1342,7 @@ static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnRegion = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnAllRefs = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_IndexedReads = 0;
 static PyTypeObject *__pyx_ptype_9csamtools_SNPCall = 0;
+static PyTypeObject *__pyx_ptype_9csamtools___pyx_Generator = 0;
 static PyTypeObject *__pyx_ptype_9csamtools___pyx_scope_struct__genexpr = 0;
 static PyTypeObject *__pyx_ptype_9csamtools___pyx_scope_struct_1_genexpr = 0;
 static PyObject *__pyx_v_9csamtools__FILENAME_ENCODING = 0;
@@ -1480,191 +1394,6 @@ static PyObject *__pyx_builtin_max;
 static PyObject *__pyx_builtin_chr;
 static PyObject *__pyx_builtin_open;
 static PyObject *__pyx_builtin_UnicodeDecodeError;
-static PyObject *__pyx_pf_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11StderrStore_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11StderrStore_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_9Fastafile___cinit__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_9csamtools_9Fastafile_8close(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static void __pyx_pf_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
-static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, struct __pyx_obj_9csamtools_Samfile *__pyx_v_template, PyObject *__pyx_v_referencenames, PyObject *__pyx_v_referencelengths, PyObject *__pyx_v_text, PyObject *__pyx_v_header, PyObject *__pyx_v_port, PyObject *__pyx_v_add_sq_text, PyObject *__pyx_v_check_header, PyObject *__pyx_v_check_sq); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_14reset(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, uint64_t __pyx_v_offset, int __pyx_v_where); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_callback, PyObject *__pyx_v_until_eof); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_until_eof); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_callback, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_32write(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_34__enter__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_36__exit__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_fields, PyObject *__pyx_v_record); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_beg, int __pyx_v_end, int __pyx_v_reopen); /* proto */
-static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__iter__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
-static void __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen); /* proto */
-static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__iter__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
-static void __pyx_pf_9csamtools_14IteratorRowAll_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile); /* proto */
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_4__iter__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_positions, int __pyx_v_reopen); /* proto */
-static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__iter__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
-static void __pyx_pf_9csamtools_20IteratorRowSelection_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2__iter__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_4addReference(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_9csamtools_Fastafile *__pyx_v_fastafile); /* proto */
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_6hasReference(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
-static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj_9csamtools_IteratorColumnRegion *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, int __pyx_v_truncate, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __pyx_obj_9csamtools_IteratorColumnRegion *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_obj_9csamtools_IteratorColumnAllRefs *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __pyx_obj_9csamtools_IteratorColumnAllRefs *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static void __pyx_pf_9csamtools_11AlignedRead_2__dealloc__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_other); /* proto */
-static Py_hash_t __pyx_pf_9csamtools_11AlignedRead_8__hash__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qname); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_values); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_cigar); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_seq); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tags); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_pos); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_bin); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, uint32_t __pyx_v_start, uint32_t __pyx_v_end); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tag); /* proto */
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_4Outs___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_id); /* proto */
-static PyObject *__pyx_pf_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fd); /* proto */
-static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_method, PyObject *__pyx_v_args, PyObject *__pyx_v_catch_stdout); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen); /* proto */
-static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self, PyObject *__pyx_v_qname); /* proto */
-static void __pyx_pf_9csamtools_12IndexedReads_6__dealloc__(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self); /* proto */
 static char __pyx_k_1[] = "Argument must be string or unicode.";
 static char __pyx_k_3[] = "Argument must be string, bytes or unicode.";
 static char __pyx_k_5[] = "\t";
@@ -1722,7 +1451,6 @@ static char __pyx_k__H[] = "H";
 static char __pyx_k__I[] = "I";
 static char __pyx_k__S[] = "S";
 static char __pyx_k__Z[] = "Z";
-static char __pyx_k__a[] = "a";
 static char __pyx_k__b[] = "b";
 static char __pyx_k__c[] = "c";
 static char __pyx_k__d[] = "d";
@@ -1854,11 +1582,10 @@ static char __pyx_k_249[] = "getfilesystemencoding";
 static char __pyx_k_250[] = "MIDNSHP=X";
 static char __pyx_k_251[] = "([MIDNSHP=X])(\\d+)";
 static char __pyx_k_253[] = "=ACMGRSVTWYHKDBN";
-static char __pyx_k_256[] = "/ifs/devel/pysam/pysam/csamtools.pyx";
-static char __pyx_k_257[] = "A pileup column. A pileup column contains\n    all the reads that map to a certain target base.\n\n    tid\n        chromosome ID as is defined in the header\n    pos\n        the target base coordinate (0-based)\n    n\n        number of reads mapping to this column\n    pileups\n        list of reads (:class:`pysam.PileupRead`) aligned to this column\n    ";
-static char __pyx_k_266[] = "\n    stderr is captured.\n    ";
-static char __pyx_k_273[] = "does nothing. stderr can't be redirected on windows";
-static char __pyx_k_290[] = "http://mail.python.org/pipermail/python-list/2000-June/038406.html";
+static char __pyx_k_254[] = "A pileup column. A pileup column contains\n    all the reads that map to a certain target base.\n\n    tid\n        chromosome ID as is defined in the header\n    pos\n        the target base coordinate (0-based)\n    n\n        number of reads mapping to this column\n    pileups\n        list of reads (:class:`pysam.PileupRead`) aligned to this column\n    ";
+static char __pyx_k_255[] = "\n    stderr is captured.\n    ";
+static char __pyx_k_256[] = "does nothing. stderr can't be redirected on windows";
+static char __pyx_k_262[] = "http://mail.python.org/pipermail/python-list/2000-June/038406.html";
 static char __pyx_k__AS[] = "AS";
 static char __pyx_k__CL[] = "CL";
 static char __pyx_k__CN[] = "CN";
@@ -1877,6 +1604,7 @@ static char __pyx_k__PG[] = "PG";
 static char __pyx_k__PI[] = "PI";
 static char __pyx_k__PL[] = "PL";
 static char __pyx_k__PN[] = "PN";
+static char __pyx_k__PP[] = "PP";
 static char __pyx_k__PU[] = "PU";
 static char __pyx_k__RG[] = "RG";
 static char __pyx_k__SM[] = "SM";
@@ -1900,11 +1628,9 @@ static char __pyx_k__bin[] = "bin";
 static char __pyx_k__chr[] = "chr";
 static char __pyx_k__dup[] = "dup";
 static char __pyx_k__end[] = "end";
-static char __pyx_k__inf[] = "inf";
 static char __pyx_k__map[] = "map";
 static char __pyx_k__max[] = "max";
 static char __pyx_k__min[] = "min";
-static char __pyx_k__ofd[] = "ofd";
 static char __pyx_k__ord[] = "ord";
 static char __pyx_k__pos[] = "pos";
 static char __pyx_k__raw[] = "raw";
@@ -1949,7 +1675,6 @@ static char __pyx_k__warn[] = "warn";
 static char __pyx_k___open[] = "_open";
 static char __pyx_k__ascii[] = "ascii";
 static char __pyx_k__bqual[] = "bqual";
-static char __pyx_k__cargs[] = "cargs";
 static char __pyx_k__cigar[] = "cigar";
 static char __pyx_k__close[] = "close";
 static char __pyx_k__flush[] = "flush";
@@ -1987,7 +1712,6 @@ static char __pyx_k__record[] = "record";
 static char __pyx_k__region[] = "region";
 static char __pyx_k__remove[] = "remove";
 static char __pyx_k__reopen[] = "reopen";
-static char __pyx_k__retval[] = "retval";
 static char __pyx_k__sorted[] = "sorted";
 static char __pyx_k__stderr[] = "stderr";
 static char __pyx_k__stdout[] = "stdout";
@@ -2037,10 +1761,6 @@ static char __pyx_k__genotype[] = "genotype";
 static char __pyx_k__nextiter[] = "nextiter";
 static char __pyx_k__platform[] = "platform";
 static char __pyx_k__samtools[] = "samtools";
-static char __pyx_k__stderr_f[] = "stderr_f";
-static char __pyx_k__stderr_h[] = "stderr_h";
-static char __pyx_k__stdout_f[] = "stdout_f";
-static char __pyx_k__stdout_h[] = "stdout_h";
 static char __pyx_k__tempfile[] = "tempfile";
 static char __pyx_k__template[] = "template";
 static char __pyx_k__truncate[] = "truncate";
@@ -2068,8 +1788,6 @@ static char __pyx_k__IS_PYTHON3[] = "IS_PYTHON3";
 static char __pyx_k__PileupRead[] = "PileupRead";
 static char __pyx_k__ValueError[] = "ValueError";
 static char __pyx_k___buildLine[] = "_buildLine";
-static char __pyx_k__out_stderr[] = "out_stderr";
-static char __pyx_k__out_stdout[] = "out_stdout";
 static char __pyx_k__references[] = "references";
 static char __pyx_k__startswith[] = "startswith";
 static char __pyx_k__AlignedRead[] = "AlignedRead";
@@ -2082,7 +1800,6 @@ static char __pyx_k__collections[] = "collections";
 static char __pyx_k__defaultdict[] = "defaultdict";
 static char __pyx_k__nreferences[] = "nreferences";
 static char __pyx_k__snp_quality[] = "snp_quality";
-static char __pyx_k__stdout_save[] = "stdout_save";
 static char __pyx_k__IndexedReads[] = "IndexedReads";
 static char __pyx_k__PileupColumn[] = "PileupColumn";
 static char __pyx_k___parseRegion[] = "_parseRegion";
@@ -2175,12 +1892,11 @@ static PyObject *__pyx_kp_s_19;
 static PyObject *__pyx_kp_s_24;
 static PyObject *__pyx_n_s_249;
 static PyObject *__pyx_kp_s_251;
+static PyObject *__pyx_kp_s_254;
+static PyObject *__pyx_kp_s_255;
 static PyObject *__pyx_kp_s_256;
-static PyObject *__pyx_kp_s_257;
-static PyObject *__pyx_kp_s_266;
-static PyObject *__pyx_kp_s_273;
+static PyObject *__pyx_kp_s_262;
 static PyObject *__pyx_kp_s_29;
-static PyObject *__pyx_kp_s_290;
 static PyObject *__pyx_kp_u_3;
 static PyObject *__pyx_kp_s_30;
 static PyObject *__pyx_kp_s_31;
@@ -2266,6 +1982,7 @@ static PyObject *__pyx_n_s__PG;
 static PyObject *__pyx_n_s__PI;
 static PyObject *__pyx_n_s__PL;
 static PyObject *__pyx_n_s__PN;
+static PyObject *__pyx_n_s__PP;
 static PyObject *__pyx_n_s__PU;
 static PyObject *__pyx_n_s__PileupColumn;
 static PyObject *__pyx_n_s__PileupProxy;
@@ -2308,7 +2025,6 @@ static PyObject *__pyx_n_s___isOpen;
 static PyObject *__pyx_n_s___open;
 static PyObject *__pyx_n_s___parseRegion;
 static PyObject *__pyx_n_s___samtools_dispatch;
-static PyObject *__pyx_n_s__a;
 static PyObject *__pyx_n_s__add_sq_text;
 static PyObject *__pyx_n_s__alignment;
 static PyObject *__pyx_n_s__all;
@@ -2321,7 +2037,6 @@ static PyObject *__pyx_n_s__bqual;
 static PyObject *__pyx_n_s__c;
 static PyObject *__pyx_n_s__calcsize;
 static PyObject *__pyx_n_s__callback;
-static PyObject *__pyx_n_s__cargs;
 static PyObject *__pyx_n_s__catch_stdout;
 static PyObject *__pyx_n_s__check_header;
 static PyObject *__pyx_n_s__check_sq;
@@ -2365,7 +2080,6 @@ static PyObject *__pyx_n_s__i;
 static PyObject *__pyx_n_s__id;
 static PyObject *__pyx_n_s__indel;
 static PyObject *__pyx_n_s__index;
-static PyObject *__pyx_n_s__inf;
 static PyObject *__pyx_n_s__is_del;
 static PyObject *__pyx_n_s__is_head;
 static PyObject *__pyx_n_s__is_tail;
@@ -2399,13 +2113,10 @@ static PyObject *__pyx_n_s__n_cigar;
 static PyObject *__pyx_n_s__nextiter;
 static PyObject *__pyx_n_s__nreferences;
 static PyObject *__pyx_n_s__object;
-static PyObject *__pyx_n_s__ofd;
 static PyObject *__pyx_n_s__offset;
 static PyObject *__pyx_n_s__open;
 static PyObject *__pyx_n_s__ord;
 static PyObject *__pyx_n_s__os;
-static PyObject *__pyx_n_s__out_stderr;
-static PyObject *__pyx_n_s__out_stdout;
 static PyObject *__pyx_n_s__pack_into;
 static PyObject *__pyx_n_s__path;
 static PyObject *__pyx_n_s__pileups;
@@ -2438,7 +2149,6 @@ static PyObject *__pyx_n_s__release;
 static PyObject *__pyx_n_s__remove;
 static PyObject *__pyx_n_s__reopen;
 static PyObject *__pyx_n_s__restore;
-static PyObject *__pyx_n_s__retval;
 static PyObject *__pyx_n_s__rlen;
 static PyObject *__pyx_n_s__rname;
 static PyObject *__pyx_n_s__s;
@@ -2456,12 +2166,7 @@ static PyObject *__pyx_n_s__split;
 static PyObject *__pyx_n_s__start;
 static PyObject *__pyx_n_s__startswith;
 static PyObject *__pyx_n_s__stderr;
-static PyObject *__pyx_n_s__stderr_f;
-static PyObject *__pyx_n_s__stderr_h;
 static PyObject *__pyx_n_s__stdout;
-static PyObject *__pyx_n_s__stdout_f;
-static PyObject *__pyx_n_s__stdout_h;
-static PyObject *__pyx_n_s__stdout_save;
 static PyObject *__pyx_n_s__stepper;
 static PyObject *__pyx_n_s__streams;
 static PyObject *__pyx_n_s__strip;
@@ -2594,41 +2299,12 @@ static PyObject *__pyx_k_tuple_182;
 static PyObject *__pyx_k_tuple_183;
 static PyObject *__pyx_k_tuple_184;
 static PyObject *__pyx_k_tuple_252;
-static PyObject *__pyx_k_tuple_254;
+static PyObject *__pyx_k_tuple_257;
 static PyObject *__pyx_k_tuple_258;
+static PyObject *__pyx_k_tuple_259;
 static PyObject *__pyx_k_tuple_260;
-static PyObject *__pyx_k_tuple_262;
-static PyObject *__pyx_k_tuple_264;
-static PyObject *__pyx_k_tuple_267;
-static PyObject *__pyx_k_tuple_269;
-static PyObject *__pyx_k_tuple_271;
-static PyObject *__pyx_k_tuple_274;
-static PyObject *__pyx_k_tuple_275;
-static PyObject *__pyx_k_tuple_276;
-static PyObject *__pyx_k_tuple_277;
-static PyObject *__pyx_k_tuple_278;
-static PyObject *__pyx_k_tuple_279;
-static PyObject *__pyx_k_tuple_281;
-static PyObject *__pyx_k_tuple_282;
-static PyObject *__pyx_k_tuple_284;
-static PyObject *__pyx_k_tuple_286;
-static PyObject *__pyx_k_tuple_288;
-static PyObject *__pyx_k_tuple_291;
-static PyObject *__pyx_k_codeobj_255;
-static PyObject *__pyx_k_codeobj_259;
-static PyObject *__pyx_k_codeobj_261;
-static PyObject *__pyx_k_codeobj_263;
-static PyObject *__pyx_k_codeobj_265;
-static PyObject *__pyx_k_codeobj_268;
-static PyObject *__pyx_k_codeobj_270;
-static PyObject *__pyx_k_codeobj_272;
-static PyObject *__pyx_k_codeobj_280;
-static PyObject *__pyx_k_codeobj_283;
-static PyObject *__pyx_k_codeobj_285;
-static PyObject *__pyx_k_codeobj_287;
-static PyObject *__pyx_k_codeobj_289;
-static PyObject *__pyx_k_codeobj_292;
-static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_k_tuple_261;
+static PyObject *__pyx_gb_9csamtools_2generator(struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */
 
 /* "csamtools.pyx":140
  * cdef char* CODE2CIGAR= "MIDNSHP=X"
@@ -2638,15 +2314,14 @@ static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_gen
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
  */
 
-static PyObject *__pyx_pf_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_pf_9csamtools_1genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_1genexpr[] = "genexpr()";
+static PyObject *__pyx_pf_9csamtools_1genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
   struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *__pyx_cur_scope;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("genexpr", 0);
+  __Pyx_RefNannySetupContext("genexpr");
   __pyx_cur_scope = (struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)__pyx_ptype_9csamtools___pyx_scope_struct__genexpr->tp_new(__pyx_ptype_9csamtools___pyx_scope_struct__genexpr, __pyx_empty_tuple, NULL);
   if (unlikely(!__pyx_cur_scope)) {
     __Pyx_RefNannyFinishContext();
@@ -2654,19 +2329,14 @@ static PyObject *__pyx_pf_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__pyx_self
   }
   __Pyx_GOTREF(__pyx_cur_scope);
   __Pyx_TraceCall("genexpr", __pyx_f[0], 140);
-  {
-    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9csamtools_4generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_cur_scope);
-    __Pyx_RefNannyFinishContext();
-    return (PyObject *) gen;
-  }
+  __pyx_self = __pyx_self;
+  __pyx_cur_scope->__pyx_base.resume_label = 0;
+  __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_9csamtools_2generator;
+  __Pyx_GIVEREF(__pyx_cur_scope);
+  __Pyx_RefNannyFinishContext();
+  return (PyObject *) __pyx_cur_scope;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_AddTraceback("csamtools.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  __pyx_L0:;
   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_TraceReturn(__pyx_r);
@@ -2674,17 +2344,16 @@ static PyObject *__pyx_pf_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__pyx_self
   return __pyx_r;
 }
 
-static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_9csamtools_2generator(struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */
 {
-  struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)__pyx_generator->closure);
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *(*__pyx_t_4)(PyObject *);
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("None", 0);
-  switch (__pyx_generator->resume_label) {
+  __Pyx_RefNannySetupContext("None");
+  switch (__pyx_cur_scope->__pyx_base.resume_label) {
     case 0: goto __pyx_L3_first_run;
     case 1: goto __pyx_L6_resume_from_yield;
     default: /* CPython raises the right error here */
@@ -2729,7 +2398,7 @@ static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_gen
     __pyx_t_1 = __pyx_t_2;
     __pyx_t_2 = 0;
     __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_y);
     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_y);
     __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_y);
@@ -2746,7 +2415,7 @@ static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_gen
     __Pyx_XGIVEREF(__pyx_r);
     __Pyx_RefNannyFinishContext();
     /* return from generator, yielding value */
-    __pyx_generator->resume_label = 1;
+    __pyx_cur_scope->__pyx_base.resume_label = 1;
     return __pyx_r;
     __pyx_L6_resume_from_yield:;
     __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
@@ -2760,7 +2429,7 @@ static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_gen
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  PyErr_SetNone(PyExc_StopIteration);
+  PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
@@ -2769,11 +2438,11 @@ static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_gen
   __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_r);
-  __pyx_generator->resume_label = -1;
+  __pyx_cur_scope->__pyx_base.resume_label = -1;
   __Pyx_RefNannyFinishContext();
   return NULL;
 }
-static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_9csamtools_4generator1(struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value); /* proto */
 
 /* "csamtools.pyx":142
  *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
@@ -2783,15 +2452,14 @@ static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_ge
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_pf_9csamtools_3genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_3genexpr[] = "genexpr()";
+static PyObject *__pyx_pf_9csamtools_3genexpr(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
   struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("genexpr", 0);
+  __Pyx_RefNannySetupContext("genexpr");
   __pyx_cur_scope = (struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)__pyx_ptype_9csamtools___pyx_scope_struct_1_genexpr->tp_new(__pyx_ptype_9csamtools___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
   if (unlikely(!__pyx_cur_scope)) {
     __Pyx_RefNannyFinishContext();
@@ -2799,19 +2467,14 @@ static PyObject *__pyx_pf_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__pyx_self
   }
   __Pyx_GOTREF(__pyx_cur_scope);
   __Pyx_TraceCall("genexpr", __pyx_f[0], 142);
-  {
-    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9csamtools_7generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_cur_scope);
-    __Pyx_RefNannyFinishContext();
-    return (PyObject *) gen;
-  }
+  __pyx_self = __pyx_self;
+  __pyx_cur_scope->__pyx_base.resume_label = 0;
+  __pyx_cur_scope->__pyx_base.body = (__pyx_generator_body_t) __pyx_gb_9csamtools_4generator1;
+  __Pyx_GIVEREF(__pyx_cur_scope);
+  __Pyx_RefNannyFinishContext();
+  return (PyObject *) __pyx_cur_scope;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_AddTraceback("csamtools.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  __pyx_L0:;
   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_TraceReturn(__pyx_r);
@@ -2819,9 +2482,8 @@ static PyObject *__pyx_pf_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__pyx_self
   return __pyx_r;
 }
 
-static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_9csamtools_4generator1(struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *__pyx_cur_scope, PyObject *__pyx_sent_value) /* generator body */
 {
-  struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -2829,8 +2491,8 @@ static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_ge
   PyObject *(*__pyx_t_4)(PyObject *);
   PyObject *__pyx_t_5 = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("None", 0);
-  switch (__pyx_generator->resume_label) {
+  __Pyx_RefNannySetupContext("None");
+  switch (__pyx_cur_scope->__pyx_base.resume_label) {
     case 0: goto __pyx_L3_first_run;
     case 1: goto __pyx_L6_resume_from_yield;
     default: /* CPython raises the right error here */
@@ -2875,7 +2537,7 @@ static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_ge
     __pyx_t_1 = __pyx_t_2;
     __pyx_t_2 = 0;
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_y);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_y);
     __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_y);
@@ -2883,7 +2545,7 @@ static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_ge
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
     __Pyx_GIVEREF(__pyx_t_5);
     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x);
@@ -2900,7 +2562,7 @@ static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_ge
     __Pyx_XGIVEREF(__pyx_r);
     __Pyx_RefNannyFinishContext();
     /* return from generator, yielding value */
-    __pyx_generator->resume_label = 1;
+    __pyx_cur_scope->__pyx_base.resume_label = 1;
     return __pyx_r;
     __pyx_L6_resume_from_yield:;
     __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
@@ -2914,7 +2576,7 @@ static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_ge
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  PyErr_SetNone(PyExc_StopIteration);
+  PyErr_SetNone(PyExc_StopIteration); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
@@ -2924,7 +2586,7 @@ static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_ge
   __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_r);
-  __pyx_generator->resume_label = -1;
+  __pyx_cur_scope->__pyx_base.resume_label = -1;
   __Pyx_RefNannyFinishContext();
   return NULL;
 }
@@ -2946,7 +2608,7 @@ static PyObject *__pyx_f_9csamtools_from_string_and_size(char *__pyx_v_s, size_t
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("from_string_and_size", 0);
+  __Pyx_RefNannySetupContext("from_string_and_size");
   __Pyx_TraceCall("from_string_and_size", __pyx_f[0], 24);
 
   /* "csamtools.pyx":25
@@ -3024,7 +2686,7 @@ static PyObject *__pyx_f_9csamtools__my_encodeFilename(PyObject *__pyx_v_filenam
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_my_encodeFilename", 0);
+  __Pyx_RefNannySetupContext("_my_encodeFilename");
   __Pyx_TraceCall("_my_encodeFilename", __pyx_f[0], 41);
 
   /* "csamtools.pyx":44
@@ -3097,7 +2759,7 @@ static PyObject *__pyx_f_9csamtools__my_encodeFilename(PyObject *__pyx_v_filenam
     __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_INCREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
     __Pyx_GIVEREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
@@ -3158,7 +2820,7 @@ static PyObject *__pyx_f_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_force_bytes", 0);
+  __Pyx_RefNannySetupContext("_force_bytes");
   __Pyx_TraceCall("_force_bytes", __pyx_f[0], 54);
 
   /* "csamtools.pyx":57
@@ -3308,7 +2970,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools__force_cmdline_bytes(PyObject
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_force_cmdline_bytes", 0);
+  __Pyx_RefNannySetupContext("_force_cmdline_bytes");
   __Pyx_TraceCall("_force_cmdline_bytes", __pyx_f[0], 68);
 
   /* "csamtools.pyx":69
@@ -3355,7 +3017,7 @@ static PyObject *__pyx_f_9csamtools__charptr_to_str(char *__pyx_v_s) {
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_charptr_to_str", 0);
+  __Pyx_RefNannySetupContext("_charptr_to_str");
   __Pyx_TraceCall("_charptr_to_str", __pyx_f[0], 71);
 
   /* "csamtools.pyx":72
@@ -3432,7 +3094,7 @@ static PyObject *__pyx_f_9csamtools__force_str(PyObject *__pyx_v_s) {
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_force_str", 0);
+  __Pyx_RefNannySetupContext("_force_str");
   __Pyx_TraceCall("_force_str", __pyx_f[0], 77);
 
   /* "csamtools.pyx":79
@@ -3559,7 +3221,7 @@ static PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("makeAlignedRead", 0);
+  __Pyx_RefNannySetupContext("makeAlignedRead");
   __Pyx_TraceCall("makeAlignedRead", __pyx_f[0], 160);
 
   /* "csamtools.pyx":162
@@ -3627,7 +3289,7 @@ static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t **__pyx_v_plp,
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("makePileupProxy", 0);
+  __Pyx_RefNannySetupContext("makePileupProxy");
   __Pyx_TraceCall("makePileupProxy", __pyx_f[0], 167);
 
   /* "csamtools.pyx":168
@@ -3725,7 +3387,7 @@ static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src) {
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("makePileupRead", 0);
+  __Pyx_RefNannySetupContext("makePileupRead");
   __Pyx_TraceCall("makePileupRead", __pyx_f[0], 176);
 
   /* "csamtools.pyx":178
@@ -3850,7 +3512,7 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
   uint8_t __pyx_v_byte_size;
   int32_t __pyx_v_nvalues;
   PyObject *__pyx_v_values = NULL;
-  CYTHON_UNUSED long __pyx_v_x;
+  long __pyx_v_x;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3863,7 +3525,7 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("convertBinaryTagToList", 0);
+  __Pyx_RefNannySetupContext("convertBinaryTagToList");
   __Pyx_TraceCall("convertBinaryTagToList", __pyx_f[0], 188);
 
   /* "csamtools.pyx":195
@@ -3919,7 +3581,7 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
  *         for x from 0 <= x < nvalues:
  */
   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_v_values = __pyx_t_1;
   __pyx_t_1 = 0;
 
@@ -3950,6 +3612,9 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
  *             s += 1
  *     elif auxtype == 'C':
  */
+      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_1 = __Pyx_PyInt_to_py_int8_t((((int8_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3994,6 +3659,9 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
  *             s += 1
  *     elif auxtype == 's':
  */
+      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_1 = __Pyx_PyInt_to_py_uint8_t((((uint8_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4038,6 +3706,9 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
  *             s += 2
  *     elif auxtype == 'S':
  */
+      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_1 = __Pyx_PyInt_to_py_int16_t((((int16_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4082,6 +3753,9 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
  *             s += 2
  *     elif auxtype == 'i':
  */
+      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_1 = __Pyx_PyInt_to_py_uint16_t((((uint16_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4126,6 +3800,9 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
  *             s += 4
  *     elif auxtype == 'I':
  */
+      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_1 = __Pyx_PyInt_to_py_int32_t((((int32_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4170,6 +3847,9 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
  *             s += 4
  *     elif auxtype == 'f':
  */
+      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t((((uint32_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4214,6 +3894,9 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
  *             s += 4
  * 
  */
+      if (unlikely(((PyObject *)__pyx_v_values) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_1 = PyFloat_FromDouble((((float *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4245,7 +3928,7 @@ static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
   __pyx_t_5 = __Pyx_PyInt_to_py_int32_t(__pyx_v_nvalues); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
@@ -4293,7 +3976,7 @@ static int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *__
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("fetch_callback", 0);
+  __Pyx_RefNannySetupContext("fetch_callback");
   __Pyx_TraceCall("fetch_callback", __pyx_f[0], 239);
 
   /* "csamtools.pyx":244
@@ -4316,7 +3999,7 @@ static int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *__
  * class PileupColumn(object):
  */
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_a);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_a);
   __Pyx_GIVEREF(__pyx_v_a);
@@ -4339,20 +4022,6 @@ static int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *__
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_12PileupColumn_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_12PileupColumn___str__[] = "PileupColumn.__str__(self)";
-static PyMethodDef __pyx_mdef_9csamtools_12PileupColumn_1__str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pw_9csamtools_12PileupColumn_1__str__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12PileupColumn___str__)};
-static PyObject *__pyx_pw_9csamtools_12PileupColumn_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_12PileupColumn___str__(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":260
  *         list of reads (:class:`pysam.PileupRead`) aligned to this column
  *     '''
@@ -4361,7 +4030,10 @@ static PyObject *__pyx_pw_9csamtools_12PileupColumn_1__str__(PyObject *__pyx_sel
  *             "\n" + "\n".join( map(str, self.pileups) )
  */
 
-static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_12PileupColumn___str__[] = "PileupColumn.__str__(self)";
+static PyMethodDef __pyx_mdef_9csamtools_12PileupColumn___str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_9csamtools_12PileupColumn___str__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12PileupColumn___str__)};
+static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -4373,8 +4045,9 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObje
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__str__", 0);
+  __Pyx_RefNannySetupContext("__str__");
   __Pyx_TraceCall("__str__", __pyx_f[0], 260);
+  __pyx_self = __pyx_self;
 
   /* "csamtools.pyx":261
  *     '''
@@ -4409,7 +4082,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObje
   __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
@@ -4420,7 +4093,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObje
   __pyx_t_3 = 0;
   __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
@@ -4431,7 +4104,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObje
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_5 = 0;
@@ -4455,7 +4128,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObje
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
@@ -4466,7 +4139,7 @@ static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObje
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
@@ -4521,7 +4194,7 @@ static int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __p
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("pileup_callback", 0);
+  __Pyx_RefNannySetupContext("pileup_callback");
   __Pyx_TraceCall("pileup_callback", __pyx_f[0], 264);
 
   /* "csamtools.pyx":281
@@ -4583,7 +4256,7 @@ static int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __p
  *     cdef int x
  */
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_v_pileups = __pyx_t_2;
   __pyx_t_2 = 0;
 
@@ -4604,6 +4277,9 @@ static int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __p
  *     p.pileups = pileups
  * 
  */
+    if (unlikely(((PyObject *)__pyx_v_pileups) == Py_None)) {
+      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
     __pyx_t_2 = __pyx_f_9csamtools_makePileupRead((&(__pyx_v_pl[__pyx_v_x]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_4 = PyList_Append(__pyx_v_pileups, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4627,7 +4303,7 @@ static int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __p
  * cdef int pileup_fetch_callback( bam1_t *b, void *data):
  */
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_p);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_p);
   __Pyx_GIVEREF(__pyx_v_p);
@@ -4664,7 +4340,7 @@ static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__p
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("pileup_fetch_callback", 0);
+  __Pyx_RefNannySetupContext("pileup_fetch_callback");
   __Pyx_TraceCall("pileup_fetch_callback", __pyx_f[0], 294);
 
   /* "csamtools.pyx":300
@@ -4702,20 +4378,6 @@ static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11StderrStore_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11StderrStore___init__[] = "StderrStore.__init__(self)";
-static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_9csamtools_11StderrStore_1__init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore___init__)};
-static PyObject *__pyx_pw_9csamtools_11StderrStore_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_11StderrStore___init__(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":308
  *     stderr is captured.
  *     '''
@@ -4724,12 +4386,16 @@ static PyObject *__pyx_pw_9csamtools_11StderrStore_1__init__(PyObject *__pyx_sel
  *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
  */
 
-static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11StderrStore___init__[] = "StderrStore.__init__(self)";
+static PyMethodDef __pyx_mdef_9csamtools_11StderrStore___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore___init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore___init__)};
+static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__init__", 0);
+  __Pyx_RefNannySetupContext("__init__");
   __Pyx_TraceCall("__init__", __pyx_f[0], 308);
+  __pyx_self = __pyx_self;
 
   /* "csamtools.pyx":309
  *     '''
@@ -4750,20 +4416,6 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(CYTHON_UNUSED PyObje
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11StderrStore_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11StderrStore_2readAndRelease[] = "StderrStore.readAndRelease(self)";
-static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_3readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pw_9csamtools_11StderrStore_3readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_2readAndRelease)};
-static PyObject *__pyx_pw_9csamtools_11StderrStore_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("readAndRelease (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_11StderrStore_2readAndRelease(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":314
  *         self.stderr_save.setfd( self.stderr_h )
  * 
@@ -4772,7 +4424,10 @@ static PyObject *__pyx_pw_9csamtools_11StderrStore_3readAndRelease(PyObject *__p
  *         self.stderr_save.restore()
  */
 
-static PyObject *__pyx_pf_9csamtools_11StderrStore_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11StderrStore_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11StderrStore_1readAndRelease[] = "StderrStore.readAndRelease(self)";
+static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_1readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_1readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_1readAndRelease)};
+static PyObject *__pyx_pf_9csamtools_11StderrStore_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -4780,8 +4435,9 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_2readAndRelease(CYTHON_UNUSED
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("readAndRelease", 0);
+  __Pyx_RefNannySetupContext("readAndRelease");
   __Pyx_TraceCall("readAndRelease", __pyx_f[0], 314);
+  __pyx_self = __pyx_self;
 
   /* "csamtools.pyx":315
  * 
@@ -4792,7 +4448,7 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_2readAndRelease(CYTHON_UNUSED
  */
   __Pyx_XDECREF(__pyx_r);
   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
   goto __pyx_L0;
@@ -4810,20 +4466,6 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_2readAndRelease(CYTHON_UNUSED
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11StderrStore_5release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11StderrStore_4release[] = "StderrStore.release(self)";
-static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_5release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pw_9csamtools_11StderrStore_5release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_4release)};
-static PyObject *__pyx_pw_9csamtools_11StderrStore_5release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("release (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_11StderrStore_4release(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":323
  *         return lines
  * 
@@ -4832,12 +4474,16 @@ static PyObject *__pyx_pw_9csamtools_11StderrStore_5release(PyObject *__pyx_self
  *         self.stderr_save.restore()
  */
 
-static PyObject *__pyx_pf_9csamtools_11StderrStore_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11StderrStore_2release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11StderrStore_2release[] = "StderrStore.release(self)";
+static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_2release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_2release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_2release)};
+static PyObject *__pyx_pf_9csamtools_11StderrStore_2release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("release", 0);
+  __Pyx_RefNannySetupContext("release");
   __Pyx_TraceCall("release", __pyx_f[0], 323);
+  __pyx_self = __pyx_self;
 
   /* "csamtools.pyx":324
  * 
@@ -4858,20 +4504,6 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_4release(CYTHON_UNUSED PyObje
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11StderrStore_7__del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11StderrStore_6__del__[] = "StderrStore.__del__(self)";
-static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_7__del__ = {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pw_9csamtools_11StderrStore_7__del__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_6__del__)};
-static PyObject *__pyx_pw_9csamtools_11StderrStore_7__del__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_11StderrStore_6__del__(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":329
  *             os.remove( self.stderr_f )
  * 
@@ -4880,7 +4512,10 @@ static PyObject *__pyx_pw_9csamtools_11StderrStore_7__del__(PyObject *__pyx_self
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11StderrStore_3__del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11StderrStore_3__del__[] = "StderrStore.__del__(self)";
+static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_3__del__ = {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_3__del__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_3__del__)};
+static PyObject *__pyx_pf_9csamtools_11StderrStore_3__del__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -4889,8 +4524,9 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED PyObje
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__del__", 0);
+  __Pyx_RefNannySetupContext("__del__");
   __Pyx_TraceCall("__del__", __pyx_f[0], 329);
+  __pyx_self = __pyx_self;
 
   /* "csamtools.pyx":330
  * 
@@ -4920,20 +4556,6 @@ static PyObject *__pyx_pf_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED PyObje
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_18StderrStoreWindows___init__[] = "StderrStoreWindows.__init__(self)";
-static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_9csamtools_18StderrStoreWindows_1__init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows___init__)};
-static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_18StderrStoreWindows___init__(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":334
  * class StderrStoreWindows():
  *     '''does nothing. stderr can't be redirected on windows'''
@@ -4942,12 +4564,16 @@ static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_1__init__(PyObject *__
  *     def release(self): pass
  */
 
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_18StderrStoreWindows___init__[] = "StderrStoreWindows.__init__(self)";
+static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows___init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows___init__)};
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__init__", 0);
+  __Pyx_RefNannySetupContext("__init__");
   __Pyx_TraceCall("__init__", __pyx_f[0], 334);
+  __pyx_self = __pyx_self;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   __Pyx_XGIVEREF(__pyx_r);
@@ -4956,20 +4582,6 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(CYTHON_UNUSED
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_18StderrStoreWindows_2readAndRelease[] = "StderrStoreWindows.readAndRelease(self)";
-static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_3readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pw_9csamtools_18StderrStoreWindows_3readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_2readAndRelease)};
-static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("readAndRelease (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_18StderrStoreWindows_2readAndRelease(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":335
  *     '''does nothing. stderr can't be redirected on windows'''
  *     def __init__(self): pass
@@ -4978,7 +4590,10 @@ static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_3readAndRelease(PyObje
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_18StderrStoreWindows_1readAndRelease[] = "StderrStoreWindows.readAndRelease(self)";
+static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_1readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_1readAndRelease)};
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -4986,11 +4601,12 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2readAndRelease(CYTHON
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("readAndRelease", 0);
+  __Pyx_RefNannySetupContext("readAndRelease");
   __Pyx_TraceCall("readAndRelease", __pyx_f[0], 335);
+  __pyx_self = __pyx_self;
   __Pyx_XDECREF(__pyx_r);
   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_r = ((PyObject *)__pyx_t_1);
   __pyx_t_1 = 0;
   goto __pyx_L0;
@@ -5008,20 +4624,6 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2readAndRelease(CYTHON
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_5release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_18StderrStoreWindows_4release[] = "StderrStoreWindows.release(self)";
-static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_5release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pw_9csamtools_18StderrStoreWindows_5release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_4release)};
-static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_5release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("release (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_18StderrStoreWindows_4release(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":336
  *     def __init__(self): pass
  *     def readAndRelease(self): return []
@@ -5030,12 +4632,16 @@ static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_5release(PyObject *__p
  * if platform.system()=='Windows':
  */
 
-static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_18StderrStoreWindows_2release[] = "StderrStoreWindows.release(self)";
+static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_2release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_2release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_2release)};
+static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("release", 0);
+  __Pyx_RefNannySetupContext("release");
   __Pyx_TraceCall("release", __pyx_f[0], 336);
+  __pyx_self = __pyx_self;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   __Pyx_XGIVEREF(__pyx_r);
@@ -5044,27 +4650,6 @@ static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_4release(CYTHON_UNUSED
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_9Fastafile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_9Fastafile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_args = 0;
-  PyObject *__pyx_v_kwargs = 0;
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
-  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
-  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
-  if (unlikely(!__pyx_v_kwargs)) return -1;
-  __Pyx_GOTREF(__pyx_v_kwargs);
-  __Pyx_INCREF(__pyx_args);
-  __pyx_v_args = __pyx_args;
-  __pyx_r = __pyx_pf_9csamtools_9Fastafile___cinit__(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
-  __Pyx_XDECREF(__pyx_v_args);
-  __Pyx_XDECREF(__pyx_v_kwargs);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":387
  *     '''
  * 
@@ -5073,19 +4658,27 @@ static int __pyx_pw_9csamtools_9Fastafile_1__cinit__(PyObject *__pyx_v_self, PyO
  *         self._filename = NULL
  */
 
-static int __pyx_pf_9csamtools_9Fastafile___cinit__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
+static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_args = 0;
+  PyObject *__pyx_v_kwargs = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
+  __Pyx_RefNannySetupContext("__cinit__");
   __Pyx_TraceCall("__cinit__", __pyx_f[0], 387);
+  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
+  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
+  if (unlikely(!__pyx_v_kwargs)) return -1;
+  __Pyx_GOTREF(__pyx_v_kwargs);
+  __Pyx_INCREF(__pyx_args);
+  __pyx_v_args = __pyx_args;
 
   /* "csamtools.pyx":388
  * 
@@ -5094,7 +4687,7 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(struct __pyx_obj_9csamtools_
  *         self._filename = NULL
  *         self._open( *args, **kwargs )
  */
-  __pyx_v_self->fastafile = NULL;
+  ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = NULL;
 
   /* "csamtools.pyx":389
  *     def __cinit__(self, *args, **kwargs ):
@@ -5103,7 +4696,7 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(struct __pyx_obj_9csamtools_
  *         self._open( *args, **kwargs )
  * 
  */
-  __pyx_v_self->_filename = NULL;
+  ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = NULL;
 
   /* "csamtools.pyx":390
  *         self.fastafile = NULL
@@ -5112,18 +4705,15 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(struct __pyx_obj_9csamtools_
  * 
  *     def _isOpen( self ):
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_3 = ((PyObject *)__pyx_v_kwargs);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -5131,27 +4721,16 @@ static int __pyx_pf_9csamtools_9Fastafile___cinit__(struct __pyx_obj_9csamtools_
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("csamtools.Fastafile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_args);
+  __Pyx_XDECREF(__pyx_v_kwargs);
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_9Fastafile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_9Fastafile_2_isOpen[] = "Fastafile._isOpen(self)\nreturn true if samfile has been opened.";
-static PyObject *__pyx_pw_9csamtools_9Fastafile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_isOpen (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_9Fastafile_2_isOpen(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":392
  *         self._open( *args, **kwargs )
  * 
@@ -5160,7 +4739,9 @@ static PyObject *__pyx_pw_9csamtools_9Fastafile_3_isOpen(PyObject *__pyx_v_self,
  *         return self.fastafile != NULL
  */
 
-static PyObject *__pyx_pf_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_9Fastafile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_9Fastafile_1_isOpen[] = "Fastafile._isOpen(self)\nreturn true if samfile has been opened.";
+static PyObject *__pyx_pf_9csamtools_9Fastafile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -5168,7 +4749,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_9csamt
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_isOpen", 0);
+  __Pyx_RefNannySetupContext("_isOpen");
   __Pyx_TraceCall("_isOpen", __pyx_f[0], 392);
 
   /* "csamtools.pyx":394
@@ -5179,7 +4760,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_9csamt
  *     def __len__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->fastafile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -5198,17 +4779,6 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_9csamt
   return __pyx_r;
 }
 
-/* Python wrapper */
-static Py_ssize_t __pyx_pw_9csamtools_9Fastafile_5__len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pw_9csamtools_9Fastafile_5__len__(PyObject *__pyx_v_self) {
-  Py_ssize_t __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_9Fastafile_4__len__(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":396
  *         return self.fastafile != NULL
  * 
@@ -5217,7 +4787,8 @@ static Py_ssize_t __pyx_pw_9csamtools_9Fastafile_5__len__(PyObject *__pyx_v_self
  *             raise ValueError( "calling len() on closed file" )
  */
 
-static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_2__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_2__len__(PyObject *__pyx_v_self) {
   Py_ssize_t __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -5226,7 +4797,7 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csam
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__len__", 0);
+  __Pyx_RefNannySetupContext("__len__");
   __Pyx_TraceCall("__len__", __pyx_f[0], 396);
 
   /* "csamtools.pyx":397
@@ -5236,7 +4807,7 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csam
  *             raise ValueError( "calling len() on closed file" )
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->fastafile == NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile == NULL);
   if (__pyx_t_1) {
 
     /* "csamtools.pyx":398
@@ -5251,9 +4822,9 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csam
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":400
  *             raise ValueError( "calling len() on closed file" )
@@ -5262,7 +4833,7 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csam
  * 
  *     def _open( self,
  */
-  __pyx_r = faidx_fetch_nseq(__pyx_v_self->fastafile);
+  __pyx_r = faidx_fetch_nseq(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile);
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -5277,18 +4848,6 @@ static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csam
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_9Fastafile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
-static char __pyx_doc_9csamtools_9Fastafile_6_open[] = "Fastafile._open(self, filename)\nopen an indexed fasta file.\n\n        This method expects an indexed fasta file.\n        ";
-static PyObject *__pyx_pw_9csamtools_9Fastafile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_open (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_9Fastafile_6_open(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self), ((PyObject *)__pyx_v_filename));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":402
  *         return faidx_fetch_nseq(self.fastafile)
  * 
@@ -5297,7 +4856,9 @@ static PyObject *__pyx_pw_9csamtools_9Fastafile_7_open(PyObject *__pyx_v_self, P
  *         '''open an indexed fasta file.
  */
 
-static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_filename) {
+static PyObject *__pyx_pf_9csamtools_9Fastafile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
+static char __pyx_doc_9csamtools_9Fastafile_3_open[] = "Fastafile._open(self, filename)\nopen an indexed fasta file.\n\n        This method expects an indexed fasta file.\n        ";
+static PyObject *__pyx_pf_9csamtools_9Fastafile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -5308,7 +4869,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_open", 0);
+  __Pyx_RefNannySetupContext("_open");
   __Pyx_TraceCall("_open", __pyx_f[0], 402);
   __Pyx_INCREF(__pyx_v_filename);
 
@@ -5319,17 +4880,17 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
  *         if self._filename != NULL: free(self._filename)
  *         filename = _my_encodeFilename(filename)
  */
-  __pyx_t_1 = (__pyx_v_self->fastafile != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL);
   if (__pyx_t_1) {
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":411
  *         # close a previously opened file
@@ -5338,12 +4899,12 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
  *         filename = _my_encodeFilename(filename)
  *         self._filename = strdup(filename)
  */
-  __pyx_t_1 = (__pyx_v_self->_filename != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename != NULL);
   if (__pyx_t_1) {
-    free(__pyx_v_self->_filename);
-    goto __pyx_L4;
+    free(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename);
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":412
  *         if self.fastafile != NULL: self.close()
@@ -5366,7 +4927,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
  * 
  */
   __pyx_t_4 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_filename = strdup(__pyx_t_4);
+  ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = strdup(__pyx_t_4);
 
   /* "csamtools.pyx":414
  *         filename = _my_encodeFilename(filename)
@@ -5376,7 +4937,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
  *         if self.fastafile == NULL:
  */
   __pyx_t_4 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->fastafile = fai_load(__pyx_t_4);
+  ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = fai_load(__pyx_t_4);
 
   /* "csamtools.pyx":416
  *         self.fastafile = fai_load( filename )
@@ -5385,7 +4946,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
  *             raise IOError("could not open file `%s`" % filename )
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->fastafile == NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile == NULL);
   if (__pyx_t_1) {
 
     /* "csamtools.pyx":417
@@ -5398,7 +4959,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
     __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
@@ -5408,9 +4969,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L5;
+    goto __pyx_L7;
   }
-  __pyx_L5:;
+  __pyx_L7:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -5427,18 +4988,6 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtoo
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_9Fastafile_9close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_9Fastafile_8close[] = "Fastafile.close(self)";
-static PyObject *__pyx_pw_9csamtools_9Fastafile_9close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("close (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_9Fastafile_8close(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":419
  *             raise IOError("could not open file `%s`" % filename )
  * 
@@ -5447,12 +4996,14 @@ static PyObject *__pyx_pw_9csamtools_9Fastafile_9close(PyObject *__pyx_v_self, C
  *             fai_destroy( self.fastafile )
  */
 
-static PyObject *__pyx_pf_9csamtools_9Fastafile_8close(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_9Fastafile_4close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_9Fastafile_4close[] = "Fastafile.close(self)";
+static PyObject *__pyx_pf_9csamtools_9Fastafile_4close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("close", 0);
+  __Pyx_RefNannySetupContext("close");
   __Pyx_TraceCall("close", __pyx_f[0], 419);
 
   /* "csamtools.pyx":420
@@ -5462,7 +5013,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8close(struct __pyx_obj_9csamtoo
  *             fai_destroy( self.fastafile )
  *             self.fastafile = NULL
  */
-  __pyx_t_1 = (__pyx_v_self->fastafile != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL);
   if (__pyx_t_1) {
 
     /* "csamtools.pyx":421
@@ -5472,7 +5023,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8close(struct __pyx_obj_9csamtoo
  *             self.fastafile = NULL
  * 
  */
-    fai_destroy(__pyx_v_self->fastafile);
+    fai_destroy(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile);
 
     /* "csamtools.pyx":422
  *         if self.fastafile != NULL:
@@ -5481,10 +5032,10 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8close(struct __pyx_obj_9csamtoo
  * 
  *     def __dealloc__(self):
  */
-    __pyx_v_self->fastafile = NULL;
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = NULL;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   __Pyx_XGIVEREF(__pyx_r);
@@ -5493,15 +5044,6 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8close(struct __pyx_obj_9csamtoo
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_9csamtools_9Fastafile_11__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_9csamtools_9Fastafile_11__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_9csamtools_9Fastafile_10__dealloc__(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
 /* "csamtools.pyx":424
  *             self.fastafile = NULL
  * 
@@ -5510,7 +5052,8 @@ static void __pyx_pw_9csamtools_9Fastafile_11__dealloc__(PyObject *__pyx_v_self)
  *         if self._filename != NULL: free(self._filename)
  */
 
-static void __pyx_pf_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
+static void __pyx_pf_9csamtools_9Fastafile_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_9Fastafile_5__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -5519,7 +5062,7 @@ static void __pyx_pf_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_9csamt
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__", 0);
+  __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 424);
 
   /* "csamtools.pyx":425
@@ -5529,7 +5072,7 @@ static void __pyx_pf_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_9csamt
  *         if self._filename != NULL: free(self._filename)
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -5543,12 +5086,12 @@ static void __pyx_pf_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_9csamt
  * 
  *     property filename:
  */
-  __pyx_t_3 = (__pyx_v_self->_filename != NULL);
+  __pyx_t_3 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename != NULL);
   if (__pyx_t_3) {
-    free(__pyx_v_self->_filename);
-    goto __pyx_L3;
+    free(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename);
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   goto __pyx_L0;
   __pyx_L1_error:;
@@ -5560,17 +5103,6 @@ static void __pyx_pf_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_9csamt
   __Pyx_RefNannyFinishContext();
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_9Fastafile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_9Fastafile_8filename_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_9Fastafile_8filename___get__(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":430
  *     property filename:
  *         '''number of :term:`filename` associated with this object.'''
@@ -5579,7 +5111,8 @@ static PyObject *__pyx_pw_9csamtools_9Fastafile_8filename_1__get__(PyObject *__p
  *             return self._filename
  */
 
-static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -5590,7 +5123,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 430);
 
   /* "csamtools.pyx":431
@@ -5600,7 +5133,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_o
  *             return self._filename
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -5614,9 +5147,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_o
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":432
  *         def __get__(self):
@@ -5626,7 +5159,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_o
  *     def fetch( self,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyBytes_FromString(__pyx_v_self->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_r = ((PyObject *)__pyx_t_2);
   __pyx_t_2 = 0;
@@ -5646,18 +5179,38 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_9Fastafile_12fetch[] = "Fastafile.fetch(self, reference=None, start=None, end=None, region=None)\n*(reference = None, start = None, end = None, region = None)*\n\n        fetch :meth:`AlignedRead` objects in a :term:`region` using 0-based indexing.\n\n        The region is specified by :term:`reference`, *start* and *end*.\n\n        fetch returns an empty string if the region is out of range or addresses an unknown *reference*.\n\n        If *reference*  [...]
-static PyObject *__pyx_pw_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":434
+ *             return self._filename
+ * 
+ *     def fetch( self,             # <<<<<<<<<<<<<<
+ *                reference = None,
+ *                start = None,
+ */
+
+static PyObject *__pyx_pf_9csamtools_9Fastafile_6fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_9Fastafile_6fetch[] = "Fastafile.fetch(self, reference=None, start=None, end=None, region=None)\n*(reference = None, start = None, end = None, region = None)*\n\n        fetch :meth:`AlignedRead` objects in a :term:`region` using 0-based indexing.\n\n        The region is specified by :term:`reference`, *start* and *end*.\n\n        fetch returns an empty string if the region is out of range or addresses an unknown *reference*.\n\n        If *reference* i [...]
+static PyObject *__pyx_pf_9csamtools_9Fastafile_6fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_region = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
-  PyObject *__pyx_r = 0;
+  int __pyx_v_length;
+  char *__pyx_v_seq;
+  PyObject *__pyx_v_py_seq = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  char *__pyx_t_5;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("fetch");
+  __Pyx_TraceCall("fetch", __pyx_f[0], 434);
   {
     PyObject* values[4] = {0,0,0,0};
 
@@ -5698,8 +5251,7 @@ static PyObject *__pyx_pw_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self,
     values[3] = ((PyObject *)Py_None);
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -5708,7 +5260,7 @@ static PyObject *__pyx_pw_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self,
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         if (kw_args > 0) {
           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
@@ -5731,7 +5283,7 @@ static PyObject *__pyx_pw_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self,
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -5756,36 +5308,6 @@ static PyObject *__pyx_pw_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self,
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_9Fastafile_12fetch(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":434
- *             return self._filename
- * 
- *     def fetch( self,             # <<<<<<<<<<<<<<
- *                reference = None,
- *                start = None,
- */
-
-static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
-  int __pyx_v_length;
-  char *__pyx_v_seq;
-  PyObject *__pyx_v_py_seq = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  char *__pyx_t_5;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("fetch", 0);
-  __Pyx_TraceCall("fetch", __pyx_f[0], 434);
   __Pyx_INCREF(__pyx_v_start);
   __Pyx_INCREF(__pyx_v_end);
   __Pyx_INCREF(__pyx_v_region);
@@ -5797,7 +5319,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -5819,9 +5341,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":461
  *         cdef char * seq
@@ -5848,9 +5370,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_Raise(__pyx_t_2, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L5;
+      goto __pyx_L8;
     }
-    __pyx_L5:;
+    __pyx_L8:;
 
     /* "csamtools.pyx":463
  *         if not region:
@@ -5864,9 +5386,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_INCREF(__pyx_int_0);
       __Pyx_DECREF(__pyx_v_start);
       __pyx_v_start = __pyx_int_0;
-      goto __pyx_L6;
+      goto __pyx_L9;
     }
-    __pyx_L6:;
+    __pyx_L9:;
 
     /* "csamtools.pyx":464
  *             if reference is None: raise ValueError( 'no sequence/region supplied.' )
@@ -5882,9 +5404,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_DECREF(__pyx_v_end);
       __pyx_v_end = __pyx_t_2;
       __pyx_t_2 = 0;
-      goto __pyx_L7;
+      goto __pyx_L10;
     }
-    __pyx_L7:;
+    __pyx_L10:;
 
     /* "csamtools.pyx":466
  *             if end is None: end = max_pos -1
@@ -5899,7 +5421,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_3) {
       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(__pyx_v_start);
       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_start);
       __Pyx_GIVEREF(__pyx_v_start);
@@ -5910,7 +5432,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
@@ -5920,9 +5442,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L8;
+      goto __pyx_L11;
     }
-    __pyx_L8:;
+    __pyx_L11:;
 
     /* "csamtools.pyx":467
  * 
@@ -5940,9 +5462,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_INCREF(((PyObject *)__pyx_kp_b_16));
       __pyx_r = ((PyObject *)__pyx_kp_b_16);
       goto __pyx_L0;
-      goto __pyx_L9;
+      goto __pyx_L12;
     }
-    __pyx_L9:;
+    __pyx_L12:;
 
     /* "csamtools.pyx":469
  *             if start == end: return b""
@@ -5968,7 +5490,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
@@ -5978,9 +5500,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L10;
+      goto __pyx_L13;
     }
-    __pyx_L10:;
+    __pyx_L13:;
 
     /* "csamtools.pyx":470
  *             # valid ranges are from 0 to 2^29-1
@@ -6006,7 +5528,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
@@ -6016,9 +5538,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L11;
+      goto __pyx_L14;
     }
-    __pyx_L11:;
+    __pyx_L14:;
 
     /* "csamtools.pyx":479
  *             #                       end-1,
@@ -6030,7 +5552,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
     __pyx_t_1 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_reference);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
     __Pyx_GIVEREF(__pyx_v_reference);
@@ -6072,9 +5594,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       __Pyx_DECREF(__pyx_v_region);
       __pyx_v_region = __pyx_t_2;
       __pyx_t_2 = 0;
-      goto __pyx_L12;
+      goto __pyx_L15;
     }
-    __pyx_L12:;
+    __pyx_L15:;
 
     /* "csamtools.pyx":483
  *                 region = region.encode('ascii')
@@ -6092,8 +5614,8 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
  *         else:
  *             # samtools adds a '\0' at the end
  */
-    __pyx_v_seq = fai_fetch(__pyx_v_self->fastafile, __pyx_t_5, (&__pyx_v_length));
-    goto __pyx_L4;
+    __pyx_v_seq = fai_fetch(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile, __pyx_t_5, (&__pyx_v_length));
+    goto __pyx_L7;
   }
   /*else*/ {
 
@@ -6105,9 +5627,9 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
  *         # copy to python
  */
     __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_seq = fai_fetch(__pyx_v_self->fastafile, __pyx_t_5, (&__pyx_v_length));
+    __pyx_v_seq = fai_fetch(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile, __pyx_t_5, (&__pyx_v_length));
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
   /* "csamtools.pyx":490
  * 
@@ -6130,7 +5652,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
     __Pyx_INCREF(((PyObject *)__pyx_kp_b_16));
     __pyx_r = ((PyObject *)__pyx_kp_b_16);
     goto __pyx_L0;
-    goto __pyx_L13;
+    goto __pyx_L16;
   }
   /*else*/ {
 
@@ -6150,7 +5672,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
  *             finally:
  *                 free(seq)
  */
-      __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_seq + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L15;}
+      __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_seq + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L18;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __pyx_v_py_seq = __pyx_t_2;
       __pyx_t_2 = 0;
@@ -6168,16 +5690,16 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
       int __pyx_exc_lineno;
       __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
-      __pyx_why = 0; goto __pyx_L16;
-      __pyx_L15: {
+      __pyx_why = 0; goto __pyx_L19;
+      __pyx_L18: {
         __pyx_why = 4;
         __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
         __pyx_exc_lineno = __pyx_lineno;
-        goto __pyx_L16;
+        goto __pyx_L19;
       }
-      __pyx_L16:;
+      __pyx_L19:;
       free(__pyx_v_seq);
       switch (__pyx_why) {
         case 4: {
@@ -6191,7 +5713,7 @@ static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamto
       }
     }
   }
-  __pyx_L13:;
+  __pyx_L16:;
 
   /* "csamtools.pyx":498
  *                 free(seq)
@@ -6235,7 +5757,7 @@ static char *__pyx_f_9csamtools_9Fastafile__fetch(struct __pyx_obj_9csamtools_Fa
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_fetch", 0);
+  __Pyx_RefNannySetupContext("_fetch");
   __Pyx_TraceCall("_fetch", __pyx_f[0], 500);
 
   /* "csamtools.pyx":507
@@ -6263,13 +5785,13 @@ static char *__pyx_f_9csamtools_9Fastafile__fetch(struct __pyx_obj_9csamtools_Fa
  *      '''
  */
 
-static int __pyx_f_9csamtools_count_callback(CYTHON_UNUSED bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
+static int __pyx_f_9csamtools_count_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
   int *__pyx_v_counter;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   long __pyx_t_1;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("count_callback", 0);
+  __Pyx_RefNannySetupContext("count_callback");
   __Pyx_TraceCall("count_callback", __pyx_f[0], 512);
 
   /* "csamtools.pyx":515
@@ -6313,7 +5835,7 @@ static int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__p
   int __pyx_t_2;
   int __pyx_t_3;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("mate_callback", 0);
+  __Pyx_RefNannySetupContext("mate_callback");
   __Pyx_TraceCall("mate_callback", __pyx_f[0], 526);
 
   /* "csamtools.pyx":529
@@ -6380,27 +5902,6 @@ static int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_7Samfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_7Samfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_args = 0;
-  PyObject *__pyx_v_kwargs = 0;
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
-  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
-  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
-  if (unlikely(!__pyx_v_kwargs)) return -1;
-  __Pyx_GOTREF(__pyx_v_kwargs);
-  __Pyx_INCREF(__pyx_args);
-  __pyx_v_args = __pyx_args;
-  __pyx_r = __pyx_pf_9csamtools_7Samfile___cinit__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
-  __Pyx_XDECREF(__pyx_v_args);
-  __Pyx_XDECREF(__pyx_v_kwargs);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":592
  *     '''
  * 
@@ -6409,19 +5910,27 @@ static int __pyx_pw_9csamtools_7Samfile_1__cinit__(PyObject *__pyx_v_self, PyObj
  *         self._filename = NULL
  */
 
-static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
+static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_args = 0;
+  PyObject *__pyx_v_kwargs = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
+  __Pyx_RefNannySetupContext("__cinit__");
   __Pyx_TraceCall("__cinit__", __pyx_f[0], 592);
+  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
+  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
+  if (unlikely(!__pyx_v_kwargs)) return -1;
+  __Pyx_GOTREF(__pyx_v_kwargs);
+  __Pyx_INCREF(__pyx_args);
+  __pyx_v_args = __pyx_args;
 
   /* "csamtools.pyx":593
  * 
@@ -6430,7 +5939,7 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Sa
  *         self._filename = NULL
  *         self.isbam = False
  */
-  __pyx_v_self->samfile = NULL;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
 
   /* "csamtools.pyx":594
  *     def __cinit__(self, *args, **kwargs ):
@@ -6439,7 +5948,7 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Sa
  *         self.isbam = False
  *         self.isstream = False
  */
-  __pyx_v_self->_filename = NULL;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = NULL;
 
   /* "csamtools.pyx":595
  *         self.samfile = NULL
@@ -6448,7 +5957,7 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Sa
  *         self.isstream = False
  *         self._open( *args, **kwargs )
  */
-  __pyx_v_self->isbam = 0;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = 0;
 
   /* "csamtools.pyx":596
  *         self._filename = NULL
@@ -6457,7 +5966,7 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Sa
  *         self._open( *args, **kwargs )
  * 
  */
-  __pyx_v_self->isstream = 0;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = 0;
 
   /* "csamtools.pyx":597
  *         self.isbam = False
@@ -6466,18 +5975,15 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Sa
  * 
  *         # allocate memory for iterator
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_3 = ((PyObject *)__pyx_v_kwargs);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "csamtools.pyx":600
  * 
@@ -6486,7 +5992,7 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Sa
  * 
  *     def _isOpen( self ):
  */
-  __pyx_v_self->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -6494,27 +6000,16 @@ static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Sa
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("csamtools.Samfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_args);
+  __Pyx_XDECREF(__pyx_v_kwargs);
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_2_isOpen[] = "Samfile._isOpen(self)\nreturn true if samfile has been opened.";
-static PyObject *__pyx_pw_9csamtools_7Samfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_isOpen (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_2_isOpen(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":602
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
  * 
@@ -6523,7 +6018,9 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_3_isOpen(PyObject *__pyx_v_self, C
  *         return self.samfile != NULL
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_1_isOpen[] = "Samfile._isOpen(self)\nreturn true if samfile has been opened.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -6531,7 +6028,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_9csamtoo
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_isOpen", 0);
+  __Pyx_RefNannySetupContext("_isOpen");
   __Pyx_TraceCall("_isOpen", __pyx_f[0], 602);
 
   /* "csamtools.pyx":604
@@ -6542,7 +6039,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_9csamtoo
  *     def _hasIndex( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->samfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -6561,18 +6058,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_9csamtoo
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_5_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_4_hasIndex[] = "Samfile._hasIndex(self)\nreturn true if samfile has an existing (and opened) index.";
-static PyObject *__pyx_pw_9csamtools_7Samfile_5_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_hasIndex (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_4_hasIndex(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":606
  *         return self.samfile != NULL
  * 
@@ -6581,7 +6066,9 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_5_hasIndex(PyObject *__pyx_v_self,
  *         return self.index != NULL
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_2_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_2_hasIndex[] = "Samfile._hasIndex(self)\nreturn true if samfile has an existing (and opened) index.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_2_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -6589,7 +6076,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_9csamt
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_hasIndex", 0);
+  __Pyx_RefNannySetupContext("_hasIndex");
   __Pyx_TraceCall("_hasIndex", __pyx_f[0], 606);
 
   /* "csamtools.pyx":608
@@ -6600,7 +6087,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_9csamt
  *     def _open( self,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->index != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -6619,10 +6106,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_9csamt
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_6_open[] = "Samfile._open(self, filename, mode=None, Samfile template=None, referencenames=None, referencelengths=None, text=None, header=None, port=None, add_sq_text=True, check_header=True, check_sq=True)\nopen a sam/bam file.\n\n        If _open is called on an existing bamfile, the current file will be\n        closed and a new file will be opened.\n        ";
-static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":610
+ *         return self.index != NULL
+ * 
+ *     def _open( self,             # <<<<<<<<<<<<<<
+ *                filename,
+ *                mode = None,
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_3_open[] = "Samfile._open(self, filename, mode=None, Samfile template=None, referencenames=None, referencelengths=None, text=None, header=None, port=None, add_sq_text=True, check_header=True, check_sq=True)\nopen a sam/bam file.\n\n        If _open is called on an existing bamfile, the current file will be\n        closed and a new file will be opened.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_v_mode = 0;
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_template = 0;
@@ -6634,10 +6128,45 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyO
   PyObject *__pyx_v_add_sq_text = 0;
   PyObject *__pyx_v_check_header = 0;
   PyObject *__pyx_v_check_sq = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,&__pyx_n_s__template,&__pyx_n_s__referencenames,&__pyx_n_s__referencelengths,&__pyx_n_s__text,&__pyx_n_s__header,&__pyx_n_s__port,&__pyx_n_s__add_sq_text,&__pyx_n_s__check_header,&__pyx_n_s__check_sq,0};
-  PyObject *__pyx_r = 0;
+  PyObject *__pyx_v_msg = NULL;
+  bam_header_t *__pyx_v_header_to_write;
+  PyObject *__pyx_v_bmode = 0;
+  char *__pyx_v_ctext;
+  PyObject *__pyx_v_n = NULL;
+  PyObject *__pyx_v_x = NULL;
+  PyObject *__pyx_v_name = NULL;
+  PyObject *__pyx_v_store = NULL;
+  PyObject *__pyx_v_ref = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_open (wrapper)", 0);
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  PyObject *__pyx_t_8 = NULL;
+  int __pyx_t_9;
+  int __pyx_t_10;
+  int __pyx_t_11;
+  char *__pyx_t_12;
+  Py_ssize_t __pyx_t_13;
+  Py_ssize_t __pyx_t_14;
+  PyObject *(*__pyx_t_15)(PyObject *);
+  size_t __pyx_t_16;
+  int32_t __pyx_t_17;
+  long __pyx_t_18;
+  uint32_t __pyx_t_19;
+  const char* __pyx_t_20;
+  int __pyx_t_21;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,&__pyx_n_s__template,&__pyx_n_s__referencenames,&__pyx_n_s__referencelengths,&__pyx_n_s__text,&__pyx_n_s__header,&__pyx_n_s__port,&__pyx_n_s__add_sq_text,&__pyx_n_s__check_header,&__pyx_n_s__check_sq,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("_open");
+  __Pyx_TraceCall("_open", __pyx_f[0], 610);
   {
     PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
 
@@ -6708,8 +6237,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyO
     values[10] = __pyx_k_23;
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
         case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
         case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
@@ -6725,7 +6253,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyO
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
         if (likely(values[0])) kw_args--;
@@ -6782,7 +6310,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyO
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -6821,66 +6349,10 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyO
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_template), __pyx_ptype_9csamtools_Samfile, 1, "template", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_6_open(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_template, __pyx_v_referencenames, __pyx_v_referencelengths, __pyx_v_text, __pyx_v_header, __pyx_v_port, __pyx_v_add_sq_text, __pyx_v_check_header, __pyx_v_check_sq);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":610
- *         return self.index != NULL
- * 
- *     def _open( self,             # <<<<<<<<<<<<<<
- *                filename,
- *                mode = None,
- */
-
-static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, struct __pyx_obj_9csamtools_Samfile *__pyx_v_template, PyObject *__pyx_v_referencenames, PyObject *__pyx_v_referencelengths, PyObject *__pyx_v_text, PyObject *__pyx_v_header, PyObject *__pyx_v_port, PyObject *__pyx_v_add_sq_text, PyObject *__pyx_v_check_header, PyObject *__pyx_v_check_sq) {
-  CYTHON_UNUSED PyObject *__pyx_v_msg = NULL;
-  bam_header_t *__pyx_v_header_to_write;
-  PyObject *__pyx_v_bmode = 0;
-  char *__pyx_v_ctext;
-  PyObject *__pyx_v_n = NULL;
-  PyObject *__pyx_v_x = NULL;
-  PyObject *__pyx_v_name = NULL;
-  PyObject *__pyx_v_store = NULL;
-  PyObject *__pyx_v_ref = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  int __pyx_t_9;
-  int __pyx_t_10;
-  int __pyx_t_11;
-  char *__pyx_t_12;
-  Py_ssize_t __pyx_t_13;
-  Py_ssize_t __pyx_t_14;
-  PyObject *(*__pyx_t_15)(PyObject *);
-  size_t __pyx_t_16;
-  int32_t __pyx_t_17;
-  long __pyx_t_18;
-  uint32_t __pyx_t_19;
-  const char* __pyx_t_20;
-  int __pyx_t_21;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_open", 0);
-  __Pyx_TraceCall("_open", __pyx_f[0], 610);
   __Pyx_INCREF(__pyx_v_filename);
   __Pyx_INCREF(__pyx_v_referencenames);
   __Pyx_INCREF(__pyx_v_text);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_template), __pyx_ptype_9csamtools_Samfile, 1, "template", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":630
  * 
@@ -6913,19 +6385,19 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                            referencenames=referencenames,
  *                            referencelengths=referencelengths,
  */
-        __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         __Pyx_INCREF(__pyx_v_filename);
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filename);
         __Pyx_GIVEREF(__pyx_v_filename);
         __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
         PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__rb));
         __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
-        __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
 
         /* "csamtools.pyx":633
  *             try:
@@ -6934,7 +6406,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                            referencelengths=referencelengths,
  *                            text=text, header=header, port=port,
  */
-        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
 
         /* "csamtools.pyx":634
  *                 self._open(filename, 'rb', template=template,
@@ -6943,7 +6415,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                            text=text, header=header, port=port,
  *                            check_header=check_header,
  */
-        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
 
         /* "csamtools.pyx":635
  *                            referencenames=referencenames,
@@ -6952,9 +6424,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                            check_header=check_header,
  *                            check_sq=check_sq)
  */
-        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
 
         /* "csamtools.pyx":636
  *                            referencelengths=referencelengths,
@@ -6963,7 +6435,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                            check_sq=check_sq)
  *                 return
  */
-        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__check_header), __pyx_v_check_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__check_header), __pyx_v_check_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
 
         /* "csamtools.pyx":637
  *                            text=text, header=header, port=port,
@@ -6972,8 +6444,8 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                 return
  *             except ValueError, msg:
  */
-        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__check_sq), __pyx_v_check_sq) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__check_sq), __pyx_v_check_sq) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+        __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
@@ -6989,19 +6461,19 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  */
         __Pyx_XDECREF(__pyx_r);
         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-        goto __pyx_L8_try_return;
+        goto __pyx_L11_try_return;
       }
       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-      goto __pyx_L11_try_end;
-      __pyx_L8_try_return:;
+      goto __pyx_L14_try_end;
+      __pyx_L11_try_return:;
       __Pyx_XGIVEREF(__pyx_t_2);
       __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
       goto __pyx_L0;
-      __pyx_L4_error:;
+      __pyx_L7_error:;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -7017,7 +6489,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("csamtools.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_6);
@@ -7026,20 +6498,20 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        goto __pyx_L5_exception_handled;
+        goto __pyx_L8_exception_handled;
       }
-      __pyx_L6_except_error:;
+      __pyx_L9_except_error:;
       __Pyx_XGIVEREF(__pyx_t_2);
       __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
       goto __pyx_L1_error;
-      __pyx_L5_exception_handled:;
+      __pyx_L8_exception_handled:;
       __Pyx_XGIVEREF(__pyx_t_2);
       __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
-      __pyx_L11_try_end:;
+      __pyx_L14_try_end:;
     }
 
     /* "csamtools.pyx":642
@@ -7049,10 +6521,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                        referencenames=referencenames,
  *                        referencelengths=referencelengths,
  */
-    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
     __Pyx_INCREF(__pyx_v_filename);
     PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filename);
     __Pyx_GIVEREF(__pyx_v_filename);
@@ -7109,7 +6581,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  * 
  */
     if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__check_sq), __pyx_v_check_sq) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
@@ -7126,9 +6598,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
     __Pyx_XDECREF(__pyx_r);
     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":650
  *             return
@@ -7194,17 +6666,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *         self.samfile = NULL
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->samfile != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL);
   if (__pyx_t_1) {
-    __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    goto __pyx_L14;
+    goto __pyx_L17;
   }
-  __pyx_L14:;
+  __pyx_L17:;
 
   /* "csamtools.pyx":656
  *         # close a previously opened file
@@ -7213,7 +6685,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  * 
  *         cdef bam_header_t * header_to_write
  */
-  __pyx_v_self->samfile = NULL;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
 
   /* "csamtools.pyx":659
  * 
@@ -7231,12 +6703,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *         filename = _my_encodeFilename(filename)
  *         cdef bytes bmode = mode.encode('ascii')
  */
-  __pyx_t_1 = (__pyx_v_self->_filename != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename != NULL);
   if (__pyx_t_1) {
-    free(__pyx_v_self->_filename);
-    goto __pyx_L15;
+    free(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename);
+    goto __pyx_L18;
   }
-  __pyx_L15:;
+  __pyx_L18:;
 
   /* "csamtools.pyx":662
  * 
@@ -7275,7 +6747,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  * 
  */
   __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_filename = strdup(__pyx_t_12);
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = strdup(__pyx_t_12);
 
   /* "csamtools.pyx":667
  *         #cfilename = filename.encode(_FILENAME_ENCODING)
@@ -7285,7 +6757,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *         self.isbam = len(mode) > 1 and mode[1] == 'b'
  */
   __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->isstream = (strcmp(__pyx_t_12, __pyx_k_26) == 0);
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = (strcmp(__pyx_t_12, __pyx_k_26) == 0);
 
   /* "csamtools.pyx":669
  *         self.isstream = strcmp( filename, "-" ) == 0
@@ -7305,7 +6777,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
   } else {
     __pyx_t_11 = __pyx_t_1;
   }
-  __pyx_v_self->isbam = __pyx_t_11;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = __pyx_t_11;
 
   /* "csamtools.pyx":671
  *         self.isbam = len(mode) > 1 and mode[1] == 'b'
@@ -7339,7 +6811,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *             strncmp(filename,"ftp:",4) == 0
  * 
  */
-  __pyx_v_self->isremote = __pyx_t_10;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote = __pyx_t_10;
 
   /* "csamtools.pyx":675
  * 
@@ -7381,7 +6853,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *             elif header:
  */
       __pyx_v_header_to_write = __pyx_v_template->samfile->header;
-      goto __pyx_L17;
+      goto __pyx_L20;
     }
 
     /* "csamtools.pyx":685
@@ -7401,8 +6873,8 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  * 
  *             else:
  */
-      __pyx_v_header_to_write = ((struct __pyx_vtabstruct_9csamtools_Samfile *)__pyx_v_self->__pyx_vtab)->_buildHeader(__pyx_v_self, __pyx_v_header);
-      goto __pyx_L17;
+      __pyx_v_header_to_write = ((struct __pyx_vtabstruct_9csamtools_Samfile *)((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->__pyx_vtab)->_buildHeader(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_header);
+      goto __pyx_L20;
     }
     /*else*/ {
 
@@ -7451,7 +6923,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                 header_to_write.n_targets = len(referencenames)
  */
       __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       if (PyList_CheckExact(__pyx_v_referencenames) || PyTuple_CheckExact(__pyx_v_referencenames)) {
         __pyx_t_8 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_8); __pyx_t_14 = 0;
         __pyx_t_15 = NULL;
@@ -7461,10 +6933,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+        if (PyList_CheckExact(__pyx_t_8)) {
           if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_8)) break;
           __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_7); __pyx_t_14++;
-        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+        } else if (PyTuple_CheckExact(__pyx_t_8)) {
           if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
           __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_7); __pyx_t_14++;
         } else {
@@ -7537,10 +7009,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __pyx_t_15 = Py_TYPE(__pyx_t_5)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_5)) {
+        if (PyList_CheckExact(__pyx_t_5)) {
           if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_5)) break;
           __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++;
-        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_5)) {
+        } else if (PyTuple_CheckExact(__pyx_t_5)) {
           if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
           __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++;
         } else {
@@ -7693,7 +7165,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                         text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
  */
         __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __Pyx_DECREF(__pyx_v_text);
         __pyx_v_text = ((PyObject *)__pyx_t_5);
         __pyx_t_5 = 0;
@@ -7725,7 +7197,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
           __pyx_t_7 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_7);
           __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_8));
           PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
           __Pyx_GIVEREF(__pyx_t_5);
           PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
@@ -7765,7 +7237,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_16), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_text);
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_text);
         __Pyx_GIVEREF(__pyx_v_text);
@@ -7776,9 +7248,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __Pyx_DECREF(__pyx_v_text);
         __pyx_v_text = __pyx_t_5;
         __pyx_t_5 = 0;
-        goto __pyx_L24;
+        goto __pyx_L27;
       }
-      __pyx_L24:;
+      __pyx_L27:;
 
       /* "csamtools.pyx":715
  *                     text = ''.join(text)
@@ -7842,9 +7314,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                 header_to_write.hash = NULL
  */
         memcpy(__pyx_v_header_to_write->text, __pyx_v_ctext, strlen(__pyx_v_ctext));
-        goto __pyx_L27;
+        goto __pyx_L30;
       }
-      __pyx_L27:;
+      __pyx_L30:;
 
       /* "csamtools.pyx":723
  *                     memcpy( header_to_write.text, ctext, strlen(ctext) )
@@ -7864,7 +7336,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  */
       __pyx_v_header_to_write->rg2lib = NULL;
     }
-    __pyx_L17:;
+    __pyx_L20:;
 
     /* "csamtools.pyx":728
  *             # open file. Header gets written to file at the same time for bam files
@@ -7890,7 +7362,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  */
     __pyx_t_20 = PyBytes_AsString(__pyx_v_filename); if (unlikely((__pyx_t_20 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_12 = PyBytes_AsString(((PyObject *)__pyx_v_bmode)); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_self->samfile = samopen(__pyx_t_20, __pyx_t_12, __pyx_v_header_to_write);
+    ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_t_20, __pyx_t_12, __pyx_v_header_to_write);
 
     /* "csamtools.pyx":730
  *             store = StderrStore()
@@ -7931,10 +7403,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *         elif mode[0] == "r":
  */
       bam_header_destroy(__pyx_v_header_to_write);
-      goto __pyx_L28;
+      goto __pyx_L31;
     }
-    __pyx_L28:;
-    goto __pyx_L16;
+    __pyx_L31:;
+    goto __pyx_L19;
   }
 
   /* "csamtools.pyx":736
@@ -7968,7 +7440,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                     not os.path.exists( filename ):
  *                 raise IOError( "file `%s` not found" % filename)
  */
-      __pyx_t_1 = (!__pyx_v_self->isremote);
+      __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
       if (__pyx_t_1) {
 
         /* "csamtools.pyx":740
@@ -7987,7 +7459,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_filename);
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filename);
         __Pyx_GIVEREF(__pyx_v_filename);
@@ -8018,7 +7490,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
       __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), __pyx_v_filename); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
       __pyx_t_8 = 0;
@@ -8028,9 +7500,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L29;
+      goto __pyx_L32;
     }
-    __pyx_L29:;
+    __pyx_L32:;
 
     /* "csamtools.pyx":744
  * 
@@ -8041,7 +7513,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  */
     __pyx_t_20 = PyBytes_AsString(__pyx_v_filename); if (unlikely((__pyx_t_20 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_12 = PyBytes_AsString(((PyObject *)__pyx_v_bmode)); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_self->samfile = samopen(__pyx_t_20, __pyx_t_12, NULL);
+    ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_t_20, __pyx_t_12, NULL);
 
     /* "csamtools.pyx":745
  *             # try to detect errors
@@ -8050,7 +7522,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                 raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
  * 
  */
-    __pyx_t_1 = (__pyx_v_self->samfile == NULL);
+    __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
     if (__pyx_t_1) {
 
       /* "csamtools.pyx":746
@@ -8063,7 +7535,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
       __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_v_mode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
       __pyx_t_8 = 0;
@@ -8073,9 +7545,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L30;
+      goto __pyx_L33;
     }
-    __pyx_L30:;
+    __pyx_L33:;
 
     /* "csamtools.pyx":749
  * 
@@ -8084,7 +7556,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                 if self.samfile.header == NULL:
  *                     raise ValueError( "file does not have valid header (mode='%s') - is it BAM format?" % mode )
  */
-    if (__pyx_v_self->isbam) {
+    if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
 
       /* "csamtools.pyx":750
  *             # bam files require a valid header
@@ -8093,7 +7565,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                     raise ValueError( "file does not have valid header (mode='%s') - is it BAM format?" % mode )
  *             else:
  */
-      __pyx_t_1 = (__pyx_v_self->samfile->header == NULL);
+      __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL);
       if (__pyx_t_1) {
 
         /* "csamtools.pyx":751
@@ -8106,7 +7578,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), __pyx_v_mode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_8));
         __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
         __pyx_t_8 = 0;
@@ -8116,10 +7588,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __Pyx_Raise(__pyx_t_8, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L32;
+        goto __pyx_L35;
       }
-      __pyx_L32:;
-      goto __pyx_L31;
+      __pyx_L35:;
+      goto __pyx_L34;
     }
     /*else*/ {
 
@@ -8132,7 +7604,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  */
       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_check_header); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_1) {
-        __pyx_t_10 = (__pyx_v_self->samfile->header == NULL);
+        __pyx_t_10 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL);
         __pyx_t_11 = __pyx_t_10;
       } else {
         __pyx_t_11 = __pyx_t_1;
@@ -8149,7 +7621,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_v_mode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_8));
         __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
         __pyx_t_8 = 0;
@@ -8159,11 +7631,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __Pyx_Raise(__pyx_t_8, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L33;
+        goto __pyx_L36;
       }
-      __pyx_L33:;
+      __pyx_L36:;
     }
-    __pyx_L31:;
+    __pyx_L34:;
 
     /* "csamtools.pyx":759
  *             # disabled for autodetection to work
@@ -8174,7 +7646,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  */
     __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_check_sq); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_11) {
-      __pyx_t_1 = (__pyx_v_self->samfile->header->n_targets == 0);
+      __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
       __pyx_t_10 = __pyx_t_1;
     } else {
       __pyx_t_10 = __pyx_t_11;
@@ -8191,7 +7663,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
       __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), __pyx_v_mode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
       __pyx_t_8 = 0;
@@ -8201,12 +7673,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L34;
+      goto __pyx_L37;
     }
-    __pyx_L34:;
-    goto __pyx_L16;
+    __pyx_L37:;
+    goto __pyx_L19;
   }
-  __pyx_L16:;
+  __pyx_L19:;
 
   /* "csamtools.pyx":762
  *                 raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
@@ -8215,7 +7687,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *             raise IOError("could not open file `%s`" % filename )
  * 
  */
-  __pyx_t_10 = (__pyx_v_self->samfile == NULL);
+  __pyx_t_10 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
   if (__pyx_t_10) {
 
     /* "csamtools.pyx":763
@@ -8228,7 +7700,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
     __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_filename); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
     PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
@@ -8238,9 +7710,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_8, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L35;
+    goto __pyx_L38;
   }
-  __pyx_L35:;
+  __pyx_L38:;
 
   /* "csamtools.pyx":766
  * 
@@ -8254,7 +7726,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
   __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_8, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   if (__pyx_t_10) {
-    __pyx_t_11 = __pyx_v_self->isbam;
+    __pyx_t_11 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam;
   } else {
     __pyx_t_11 = __pyx_t_10;
   }
@@ -8267,7 +7739,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                 if not os.path.exists(filename + b".bai"):
  *                     self.index = NULL
  */
-    __pyx_t_11 = (!__pyx_v_self->isremote);
+    __pyx_t_11 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
     if (__pyx_t_11) {
 
       /* "csamtools.pyx":769
@@ -8288,7 +7760,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
       __pyx_t_7 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_b_37)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __pyx_t_7 = 0;
@@ -8308,8 +7780,8 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                 else:
  *                     # returns NULL if there is no index or index could not be opened
  */
-        __pyx_v_self->index = NULL;
-        goto __pyx_L38;
+        ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = NULL;
+        goto __pyx_L41;
       }
       /*else*/ {
 
@@ -8321,7 +7793,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                         raise IOError("error while opening index `%s` " % filename )
  */
         __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_v_self->index = bam_index_load(__pyx_t_12);
+        ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = bam_index_load(__pyx_t_12);
 
         /* "csamtools.pyx":774
  *                     # returns NULL if there is no index or index could not be opened
@@ -8330,7 +7802,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                         raise IOError("error while opening index `%s` " % filename )
  *             else:
  */
-        __pyx_t_10 = (__pyx_v_self->index == NULL);
+        __pyx_t_10 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
         if (__pyx_t_10) {
 
           /* "csamtools.pyx":775
@@ -8343,7 +7815,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
           __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), __pyx_v_filename); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_7));
           __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_5);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
           PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
           __pyx_t_7 = 0;
@@ -8353,12 +7825,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
           __Pyx_Raise(__pyx_t_7, 0, 0, 0);
           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
           {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          goto __pyx_L39;
+          goto __pyx_L42;
         }
-        __pyx_L39:;
+        __pyx_L42:;
       }
-      __pyx_L38:;
-      goto __pyx_L37;
+      __pyx_L41:;
+      goto __pyx_L40;
     }
     /*else*/ {
 
@@ -8370,7 +7842,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                     raise IOError("error while opening index `%s` " % filename )
  */
       __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_self->index = bam_index_load(__pyx_t_12);
+      ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = bam_index_load(__pyx_t_12);
 
       /* "csamtools.pyx":778
  *             else:
@@ -8379,7 +7851,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                     raise IOError("error while opening index `%s` " % filename )
  * 
  */
-      __pyx_t_10 = (__pyx_v_self->index == NULL);
+      __pyx_t_10 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
       if (__pyx_t_10) {
 
         /* "csamtools.pyx":779
@@ -8392,7 +7864,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), __pyx_v_filename); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
         __pyx_t_7 = 0;
@@ -8402,11 +7874,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
         __Pyx_Raise(__pyx_t_7, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L40;
+        goto __pyx_L43;
       }
-      __pyx_L40:;
+      __pyx_L43:;
     }
-    __pyx_L37:;
+    __pyx_L40:;
 
     /* "csamtools.pyx":781
  *                     raise IOError("error while opening index `%s` " % filename )
@@ -8415,7 +7887,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  *                 self.start_offset = bam_tell( self.samfile.x.bam )
  * 
  */
-    __pyx_t_10 = (!__pyx_v_self->isstream);
+    __pyx_t_10 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream);
     if (__pyx_t_10) {
 
       /* "csamtools.pyx":782
@@ -8425,13 +7897,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
  * 
  *     def gettid( self, reference ):
  */
-      __pyx_v_self->start_offset = bam_tell(__pyx_v_self->samfile->x.bam);
-      goto __pyx_L41;
+      ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->start_offset = bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam);
+      goto __pyx_L44;
     }
-    __pyx_L41:;
-    goto __pyx_L36;
+    __pyx_L44:;
+    goto __pyx_L39;
   }
-  __pyx_L36:;
+  __pyx_L39:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -8459,18 +7931,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_9gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_8gettid[] = "Samfile.gettid(self, reference)\n\n        convert :term:`reference` name into numerical :term:`tid`\n\n        returns -1 if reference is not known.\n        ";
-static PyObject *__pyx_pw_9csamtools_7Samfile_9gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("gettid (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_8gettid(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((PyObject *)__pyx_v_reference));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":784
  *                 self.start_offset = bam_tell( self.samfile.x.bam )
  * 
@@ -8479,7 +7939,9 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_9gettid(PyObject *__pyx_v_self, Py
  *         convert :term:`reference` name into numerical :term:`tid`
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_4gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_4gettid[] = "Samfile.gettid(self, reference)\n\n        convert :term:`reference` name into numerical :term:`tid`\n\n        returns -1 if reference is not known.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_4gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -8491,7 +7953,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtool
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("gettid", 0);
+  __Pyx_RefNannySetupContext("gettid");
   __Pyx_TraceCall("gettid", __pyx_f[0], 784);
   __Pyx_INCREF(__pyx_v_reference);
 
@@ -8502,7 +7964,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtool
  *         reference = _force_bytes(reference)
  *         return pysam_reference2tid( self.samfile.header, reference )
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -8516,9 +7978,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtool
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":791
  *         '''
@@ -8542,7 +8004,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtool
  */
   __Pyx_XDECREF(__pyx_r);
   __pyx_t_5 = PyBytes_AsString(__pyx_v_reference); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = PyInt_FromLong(pysam_reference2tid(__pyx_v_self->samfile->header, __pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(pysam_reference2tid(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header, __pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -8563,18 +8025,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_11getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_10getrname[] = "Samfile.getrname(self, tid)\n\n        convert numerical :term:`tid` into :term:`reference` name.";
-static PyObject *__pyx_pw_9csamtools_7Samfile_11getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("getrname (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_10getrname(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":794
  *         return pysam_reference2tid( self.samfile.header, reference )
  * 
@@ -8583,7 +8033,9 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_11getrname(PyObject *__pyx_v_self,
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_tid) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_5getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_5getrname[] = "Samfile.getrname(self, tid)\n\n        convert numerical :term:`tid` into :term:`reference` name.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_5getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -8595,7 +8047,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamt
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getrname", 0);
+  __Pyx_RefNannySetupContext("getrname");
   __Pyx_TraceCall("getrname", __pyx_f[0], 794);
 
   /* "csamtools.pyx":797
@@ -8605,7 +8057,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamt
  *         if not 0 <= tid < self.samfile.header.n_targets:
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -8619,9 +8071,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamt
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":798
  *         convert numerical :term:`tid` into :term:`reference` name.'''
@@ -8634,7 +8086,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamt
   __Pyx_GOTREF(__pyx_t_2);
   if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
     __Pyx_DECREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_2 = PyObject_RichCompare(__pyx_v_tid, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
@@ -8652,10 +8104,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamt
  *         return _charptr_to_str(self.samfile.header.target_name[tid])
  * 
  */
-    __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_tid);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tid);
     __Pyx_GIVEREF(__pyx_v_tid);
@@ -8666,7 +8118,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamt
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __pyx_t_2 = 0;
@@ -8676,9 +8128,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamt
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":800
  *         if not 0 <= tid < self.samfile.header.n_targets:
@@ -8689,7 +8141,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamt
  */
   __Pyx_XDECREF(__pyx_r);
   __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_tid); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_f_9csamtools__charptr_to_str((__pyx_v_self->samfile->header->target_name[__pyx_t_5])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools__charptr_to_str((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_t_5])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -8729,7 +8181,7 @@ static char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_S
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_getrname", 0);
+  __Pyx_RefNannySetupContext("_getrname");
   __Pyx_TraceCall("_getrname", __pyx_f[0], 802);
 
   /* "csamtools.pyx":805
@@ -8783,7 +8235,7 @@ static char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_S
     __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
@@ -8794,7 +8246,7 @@ static char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_S
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
     __pyx_t_1 = 0;
@@ -8832,18 +8284,47 @@ static char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_S
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_12_parseRegion[] = "Samfile._parseRegion(self, reference=None, start=None, end=None, region=None)\n\n        parse region information.\n\n        raise ValueError for for invalid regions.\n\n        returns a tuple of flag, tid, start and end. Flag indicates\n        whether some coordinates were supplied.\n\n        Note that regions are 1-based, while start,end are python coordinates.\n        ";
-static PyObject *__pyx_pw_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":810
+ *         return self.samfile.header.target_name[tid]
+ * 
+ *     def _parseRegion( self,             # <<<<<<<<<<<<<<
+ *                       reference = None,
+ *                       start = None,
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_6_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_6_parseRegion[] = "Samfile._parseRegion(self, reference=None, start=None, end=None, region=None)\n\n        parse region information.\n\n        raise ValueError for for invalid regions.\n\n        returns a tuple of flag, tid, start and end. Flag indicates\n        whether some coordinates were supplied.\n\n        Note that regions are 1-based, while start,end are python coordinates.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_6_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_region = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
-  PyObject *__pyx_r = 0;
+  int __pyx_v_rtid;
+  PY_LONG_LONG __pyx_v_rstart;
+  PY_LONG_LONG __pyx_v_rend;
+  PyObject *__pyx_v_parts = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_parseRegion (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  PY_LONG_LONG __pyx_t_6;
+  int __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("_parseRegion");
+  __Pyx_TraceCall("_parseRegion", __pyx_f[0], 810);
   {
     PyObject* values[4] = {0,0,0,0};
 
@@ -8884,8 +8365,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_s
     values[3] = ((PyObject *)Py_None);
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -8894,7 +8374,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_s
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         if (kw_args > 0) {
           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
@@ -8917,7 +8397,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_s
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -8942,45 +8422,6 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_s
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_12_parseRegion(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":810
- *         return self.samfile.header.target_name[tid]
- * 
- *     def _parseRegion( self,             # <<<<<<<<<<<<<<
- *                       reference = None,
- *                       start = None,
- */
-
-static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
-  int __pyx_v_rtid;
-  PY_LONG_LONG __pyx_v_rstart;
-  PY_LONG_LONG __pyx_v_rend;
-  PyObject *__pyx_v_parts = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  PY_LONG_LONG __pyx_t_6;
-  int __pyx_t_7;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *__pyx_t_9 = NULL;
-  PyObject *__pyx_t_10 = NULL;
-  PyObject *__pyx_t_11 = NULL;
-  Py_ssize_t __pyx_t_12;
-  int __pyx_t_13;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_parseRegion", 0);
-  __Pyx_TraceCall("_parseRegion", __pyx_f[0], 810);
   __Pyx_INCREF(__pyx_v_reference);
   __Pyx_INCREF(__pyx_v_region);
 
@@ -9045,14 +8486,14 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
  *             except OverflowError:
  *                 raise ValueError( 'start out of range (%i)' % start )
  */
-        __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_v_start); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_v_start); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
         __pyx_v_rstart = __pyx_t_6;
       }
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      goto __pyx_L11_try_end;
-      __pyx_L4_error:;
+      goto __pyx_L14_try_end;
+      __pyx_L7_error:;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
 
       /* "csamtools.pyx":839
@@ -9065,7 +8506,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
       __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
       if (__pyx_t_7) {
         __Pyx_AddTraceback("csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_GOTREF(__pyx_t_9);
@@ -9077,40 +8518,40 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
  * 
  *         if end != None:
  */
-        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
-        __Pyx_GOTREF(__pyx_t_11);
+        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_11));
         PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_10));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
         __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
         __Pyx_Raise(__pyx_t_10, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        goto __pyx_L5_exception_handled;
+        goto __pyx_L8_exception_handled;
       }
-      __pyx_L6_except_error:;
+      __pyx_L9_except_error:;
       __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
-      __pyx_L5_exception_handled:;
+      __pyx_L8_exception_handled:;
       __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
-      __pyx_L11_try_end:;
+      __pyx_L14_try_end:;
     }
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":842
  *                 raise ValueError( 'start out of range (%i)' % start )
@@ -9146,14 +8587,14 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
  *             except OverflowError:
  *                 raise ValueError( 'end out of range (%i)' % end )
  */
-        __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_v_end); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
+        __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_v_end); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
         __pyx_v_rend = __pyx_t_6;
       }
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-      goto __pyx_L22_try_end;
-      __pyx_L15_error:;
+      goto __pyx_L25_try_end;
+      __pyx_L18_error:;
       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -9170,7 +8611,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
       __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
       if (__pyx_t_7) {
         __Pyx_AddTraceback("csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
+        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_GOTREF(__pyx_t_1);
@@ -9182,40 +8623,40 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
  * 
  *         if region:
  */
-        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_end); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
+        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_end); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
-        __Pyx_GOTREF(__pyx_t_11);
+        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_11));
         PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_10));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
         __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
+        __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
         __Pyx_Raise(__pyx_t_10, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        goto __pyx_L16_exception_handled;
+        goto __pyx_L19_exception_handled;
       }
-      __pyx_L17_except_error:;
+      __pyx_L20_except_error:;
       __Pyx_XGIVEREF(__pyx_t_5);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
       goto __pyx_L1_error;
-      __pyx_L16_exception_handled:;
+      __pyx_L19_exception_handled:;
       __Pyx_XGIVEREF(__pyx_t_5);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
-      __pyx_L22_try_end:;
+      __pyx_L25_try_end:;
     }
-    goto __pyx_L14;
+    goto __pyx_L17;
   }
-  __pyx_L14:;
+  __pyx_L17:;
 
   /* "csamtools.pyx":848
  *                 raise ValueError( 'end out of range (%i)' % end )
@@ -9253,7 +8694,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_43));
     __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
@@ -9293,7 +8734,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
       __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
       __Pyx_GIVEREF(__pyx_t_9);
       __pyx_t_9 = 0;
@@ -9306,9 +8747,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
       __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_v_rstart = __pyx_t_6;
-      goto __pyx_L26;
+      goto __pyx_L29;
     }
-    __pyx_L26:;
+    __pyx_L29:;
 
     /* "csamtools.pyx":853
  *             reference = parts[0]
@@ -9323,7 +8764,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
       __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_parts, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_9));
       PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
       __Pyx_GIVEREF(__pyx_t_1);
       __pyx_t_1 = 0;
@@ -9333,12 +8774,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
       __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __pyx_v_rend = __pyx_t_6;
-      goto __pyx_L27;
+      goto __pyx_L30;
     }
-    __pyx_L27:;
-    goto __pyx_L25;
+    __pyx_L30:;
+    goto __pyx_L28;
   }
-  __pyx_L25:;
+  __pyx_L28:;
 
   /* "csamtools.pyx":855
  *             if len(parts) >= 3: rend = int(parts[2])
@@ -9354,9 +8795,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_INCREF(((PyObject *)__pyx_k_tuple_44));
     __pyx_r = ((PyObject *)__pyx_k_tuple_44);
     goto __pyx_L0;
-    goto __pyx_L28;
+    goto __pyx_L31;
   }
-  __pyx_L28:;
+  __pyx_L31:;
 
   /* "csamtools.pyx":857
  *         if not reference: return 0, 0, 0, 0
@@ -9365,10 +8806,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
   __Pyx_INCREF(__pyx_v_reference);
   PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
@@ -9392,7 +8833,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), __pyx_v_reference); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
@@ -9402,9 +8843,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_Raise(__pyx_t_8, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L29;
+    goto __pyx_L32;
   }
-  __pyx_L29:;
+  __pyx_L32:;
 
   /* "csamtools.pyx":859
  *         rtid = self.gettid( reference )
@@ -9420,7 +8861,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __pyx_t_9 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
     __Pyx_GIVEREF(__pyx_t_8);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9);
@@ -9431,7 +8872,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
     __pyx_t_9 = 0;
@@ -9441,9 +8882,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_Raise(__pyx_t_9, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L30;
+    goto __pyx_L33;
   }
-  __pyx_L30:;
+  __pyx_L33:;
 
   /* "csamtools.pyx":860
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
@@ -9464,7 +8905,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
     __pyx_t_1 = 0;
@@ -9474,9 +8915,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L31;
+    goto __pyx_L34;
   }
-  __pyx_L31:;
+  __pyx_L34:;
 
   /* "csamtools.pyx":861
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
@@ -9497,7 +8938,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
     __pyx_t_9 = 0;
@@ -9507,9 +8948,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
     __Pyx_Raise(__pyx_t_9, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L32;
+    goto __pyx_L35;
   }
-  __pyx_L32:;
+  __pyx_L35:;
 
   /* "csamtools.pyx":863
  *         if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
@@ -9526,7 +8967,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
   __pyx_t_8 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
   __Pyx_INCREF(__pyx_int_1);
   PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
@@ -9563,18 +9004,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_15reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_14reset[] = "Samfile.reset(self)\nreset file position to beginning of read section.";
-static PyObject *__pyx_pw_9csamtools_7Samfile_15reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("reset (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_14reset(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":865
  *         return 1, rtid, rstart, rend
  * 
@@ -9583,7 +9012,9 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_15reset(PyObject *__pyx_v_self, CY
  *         return self.seek( self.start_offset, 0 )
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_14reset(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_7reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_7reset[] = "Samfile.reset(self)\nreset file position to beginning of read section.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_7reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -9593,7 +9024,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_14reset(struct __pyx_obj_9csamtool
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("reset", 0);
+  __Pyx_RefNannySetupContext("reset");
   __Pyx_TraceCall("reset", __pyx_f[0], 865);
 
   /* "csamtools.pyx":867
@@ -9604,12 +9035,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_14reset(struct __pyx_obj_9csamtool
  *     def seek( self, uint64_t offset, int where = 0):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(__pyx_v_self->start_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->start_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_INCREF(__pyx_int_0);
@@ -9639,29 +9070,44 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_14reset(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_17seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_16seek[] = "Samfile.seek(self, uint64_t offset, int where=0)\n\n        move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.\n        ";
-static PyObject *__pyx_pw_9csamtools_7Samfile_17seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":869
+ *         return self.seek( self.start_offset, 0 )
+ * 
+ *     def seek( self, uint64_t offset, int where = 0):             # <<<<<<<<<<<<<<
+ *         '''
+ *         move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_8seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_8seek[] = "Samfile.seek(self, uint64_t offset, int where=0)\n\n        move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_8seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   uint64_t __pyx_v_offset;
   int __pyx_v_where;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__where,0};
-  PyObject *__pyx_r = 0;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("seek (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__where,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("seek");
+  __Pyx_TraceCall("seek", __pyx_f[0], 869);
   {
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset);
         if (likely(values[0])) kw_args--;
@@ -9673,11 +9119,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_17seek(PyObject *__pyx_v_self, PyO
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-      if (values[1]) {
-      } else {
-        __pyx_v_where = ((int)0);
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -9702,32 +9144,6 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_17seek(PyObject *__pyx_v_self, PyO
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_16seek(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_offset, __pyx_v_where);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":869
- *         return self.seek( self.start_offset, 0 )
- * 
- *     def seek( self, uint64_t offset, int where = 0):             # <<<<<<<<<<<<<<
- *         '''
- *         move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.
- */
-
-static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, uint64_t __pyx_v_offset, int __pyx_v_where) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("seek", 0);
-  __Pyx_TraceCall("seek", __pyx_f[0], 869);
 
   /* "csamtools.pyx":874
  *         '''
@@ -9736,7 +9152,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -9758,9 +9174,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":876
  *         if not self._isOpen():
@@ -9769,7 +9185,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools
  *             raise NotImplementedError("seek only available in bam files")
  *         if self.isstream:
  */
-  __pyx_t_4 = (!__pyx_v_self->isbam);
+  __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
   if (__pyx_t_4) {
 
     /* "csamtools.pyx":877
@@ -9784,9 +9200,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L7;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
   /* "csamtools.pyx":878
  *         if not self.isbam:
@@ -9795,7 +9211,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools
  *             raise OSError("seek no available in streams")
  * 
  */
-  if (__pyx_v_self->isstream) {
+  if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) {
 
     /* "csamtools.pyx":879
  *             raise NotImplementedError("seek only available in bam files")
@@ -9809,9 +9225,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L5;
+    goto __pyx_L8;
   }
-  __pyx_L5:;
+  __pyx_L8:;
 
   /* "csamtools.pyx":881
  *             raise OSError("seek no available in streams")
@@ -9821,7 +9237,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools
  *     def tell( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_seek(__pyx_v_self->samfile->x.bam, __pyx_v_offset, __pyx_v_where)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_seek(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, __pyx_v_offset, __pyx_v_where)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -9841,18 +9257,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_19tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_18tell[] = "Samfile.tell(self)\n\n        return current file position\n        ";
-static PyObject *__pyx_pw_9csamtools_7Samfile_19tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("tell (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_18tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":883
  *         return bam_seek( self.samfile.x.bam, offset, where )
  * 
@@ -9861,7 +9265,9 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_19tell(PyObject *__pyx_v_self, CYT
  *         return current file position
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_9tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_9tell[] = "Samfile.tell(self)\n\n        return current file position\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_9tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -9872,7 +9278,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("tell", 0);
+  __Pyx_RefNannySetupContext("tell");
   __Pyx_TraceCall("tell", __pyx_f[0], 883);
 
   /* "csamtools.pyx":887
@@ -9882,7 +9288,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -9904,9 +9310,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":889
  *         if not self._isOpen():
@@ -9915,7 +9321,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools
  *             raise NotImplementedError("seek only available in bam files")
  * 
  */
-  __pyx_t_4 = (!__pyx_v_self->isbam);
+  __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
   if (__pyx_t_4) {
 
     /* "csamtools.pyx":890
@@ -9930,9 +9336,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":892
  *             raise NotImplementedError("seek only available in bam files")
@@ -9942,7 +9348,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools
  *     def fetch( self,
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_tell(__pyx_v_self->samfile->x.bam)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -9962,20 +9368,52 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_20fetch[] = "Samfile.fetch(self, reference=None, start=None, end=None, region=None, callback=None, until_eof=False)\n\n        fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can\n        be supplied.\n\n        Without *reference* or *region* all mapped reads will be fetched. The reads will be returned\n       [...]
-static PyObject *__pyx_pw_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":894
+ *         return bam_tell( self.samfile.x.bam )
+ * 
+ *     def fetch( self,             # <<<<<<<<<<<<<<
+ *                reference = None,
+ *                start = None,
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_10fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_10fetch[] = "Samfile.fetch(self, reference=None, start=None, end=None, region=None, callback=None, until_eof=False)\n\n        fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can\n        be supplied.\n\n        Without *reference* or *region* all mapped reads will be fetched. The reads will be returned\n       [...]
+static PyObject *__pyx_pf_9csamtools_7Samfile_10fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_region = 0;
   PyObject *__pyx_v_callback = 0;
   PyObject *__pyx_v_until_eof = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,&__pyx_n_s__until_eof,0};
-  PyObject *__pyx_r = 0;
+  int __pyx_v_rtid;
+  int __pyx_v_rstart;
+  int __pyx_v_rend;
+  int __pyx_v_has_coord;
+  int __pyx_v_reopen;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *(*__pyx_t_9)(PyObject *);
+  int __pyx_t_10;
+  int __pyx_t_11;
+  int __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_t_14;
+  int __pyx_t_15;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,&__pyx_n_s__until_eof,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("fetch");
+  __Pyx_TraceCall("fetch", __pyx_f[0], 894);
   {
     PyObject* values[6] = {0,0,0,0,0,0};
 
@@ -10026,8 +9464,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, Py
     values[5] = __pyx_k_54;
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
@@ -10038,7 +9475,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, Py
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         if (kw_args > 0) {
           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
@@ -10071,7 +9508,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, Py
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -10100,48 +9537,6 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, Py
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_20fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_callback, __pyx_v_until_eof);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":894
- *         return bam_tell( self.samfile.x.bam )
- * 
- *     def fetch( self,             # <<<<<<<<<<<<<<
- *                reference = None,
- *                start = None,
- */
-
-static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_callback, PyObject *__pyx_v_until_eof) {
-  int __pyx_v_rtid;
-  int __pyx_v_rstart;
-  int __pyx_v_rend;
-  int __pyx_v_has_coord;
-  int __pyx_v_reopen;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *(*__pyx_t_9)(PyObject *);
-  int __pyx_t_10;
-  int __pyx_t_11;
-  int __pyx_t_12;
-  int __pyx_t_13;
-  int __pyx_t_14;
-  int __pyx_t_15;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("fetch", 0);
-  __Pyx_TraceCall("fetch", __pyx_f[0], 894);
 
   /* "csamtools.pyx":924
  *         cdef int rtid, rstart, rend, has_coord
@@ -10150,7 +9545,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -10172,9 +9567,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":927
  *             raise ValueError( "I/O operation on closed file" )
@@ -10183,10 +9578,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  * 
  *         if self.isstream: reopen = False
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_reference);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
@@ -10237,23 +9632,23 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-    index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
+    index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_1);
-    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
+    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_2);
-    index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
+    index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_6);
-    index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
+    index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_7);
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    goto __pyx_L5_unpacking_done;
-    __pyx_L4_unpacking_failed:;
+    goto __pyx_L8_unpacking_done;
+    __pyx_L7_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
     if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_L5_unpacking_done:;
+    __pyx_L8_unpacking_done:;
   }
   __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -10275,9 +9670,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  *         else: reopen = True
  * 
  */
-  if (__pyx_v_self->isstream) {
+  if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) {
     __pyx_v_reopen = 0;
-    goto __pyx_L6;
+    goto __pyx_L9;
   }
   /*else*/ {
 
@@ -10290,7 +9685,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  */
     __pyx_v_reopen = 1;
   }
-  __pyx_L6:;
+  __pyx_L9:;
 
   /* "csamtools.pyx":932
  *         else: reopen = True
@@ -10299,7 +9694,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )
  */
-  if (__pyx_v_self->isbam) {
+  if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
 
     /* "csamtools.pyx":933
  * 
@@ -10311,7 +9706,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = (!__pyx_t_4);
     if (__pyx_t_3) {
-      __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
@@ -10320,7 +9715,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_14 = (!__pyx_t_4);
       if (__pyx_t_14) {
-        __pyx_t_4 = (!__pyx_v_self->isremote);
+        __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
         __pyx_t_15 = __pyx_t_4;
       } else {
         __pyx_t_15 = __pyx_t_14;
@@ -10343,9 +9738,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
       __Pyx_Raise(__pyx_t_7, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L8;
+      goto __pyx_L11;
     }
-    __pyx_L8:;
+    __pyx_L11:;
 
     /* "csamtools.pyx":936
  *                 raise ValueError( "fetch called on bamfile without index" )
@@ -10371,9 +9766,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
         __Pyx_Raise(__pyx_t_7, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L10;
+        goto __pyx_L13;
       }
-      __pyx_L10:;
+      __pyx_L13:;
 
       /* "csamtools.pyx":938
  *             if callback:
@@ -10382,7 +9777,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  *                 return bam_fetch(self.samfile.x.bam,
  *                                  self.index,
  */
-      __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
@@ -10396,9 +9791,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
         __Pyx_Raise(__pyx_t_5, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L11;
+        goto __pyx_L14;
       }
-      __pyx_L11:;
+      __pyx_L14:;
 
       /* "csamtools.pyx":939
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
@@ -10416,12 +9811,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  *             else:
  *                 if has_coord:
  */
-      __pyx_t_5 = PyInt_FromLong(bam_fetch(__pyx_v_self->samfile->x.bam, __pyx_v_self->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)__pyx_v_callback), __pyx_f_9csamtools_fetch_callback)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyInt_FromLong(bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)__pyx_v_callback), __pyx_f_9csamtools_fetch_callback)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __pyx_r = __pyx_t_5;
       __pyx_t_5 = 0;
       goto __pyx_L0;
-      goto __pyx_L9;
+      goto __pyx_L12;
     }
     /*else*/ {
 
@@ -10449,10 +9844,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
         __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_INCREF(((PyObject *)__pyx_v_self));
-        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+        __Pyx_INCREF(__pyx_v_self);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
+        __Pyx_GIVEREF(__pyx_v_self);
         PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
         __Pyx_GIVEREF(__pyx_t_5);
         PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7);
@@ -10468,14 +9863,14 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
         __Pyx_GOTREF(__pyx_t_7);
         if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
         __pyx_r = __pyx_t_7;
         __pyx_t_7 = 0;
         goto __pyx_L0;
-        goto __pyx_L12;
+        goto __pyx_L15;
       }
       /*else*/ {
 
@@ -10498,24 +9893,24 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  */
           __Pyx_XDECREF(__pyx_r);
           __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
-          __Pyx_INCREF(((PyObject *)__pyx_v_self));
-          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self));
-          __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+          __Pyx_INCREF(__pyx_v_self);
+          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
+          __Pyx_GIVEREF(__pyx_v_self);
           __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_6));
           __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_2);
           if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-          __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_2);
           __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
           __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
           __pyx_r = __pyx_t_2;
           __pyx_t_2 = 0;
           goto __pyx_L0;
-          goto __pyx_L13;
+          goto __pyx_L16;
         }
         /*else*/ {
 
@@ -10528,10 +9923,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  */
           __Pyx_XDECREF(__pyx_r);
           __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          __Pyx_INCREF(((PyObject *)__pyx_v_self));
-          PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
-          __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+          __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+          __Pyx_INCREF(__pyx_v_self);
+          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
+          __Pyx_GIVEREF(__pyx_v_self);
           __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAllRefs)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_6);
           __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
@@ -10539,12 +9934,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
           __pyx_t_6 = 0;
           goto __pyx_L0;
         }
-        __pyx_L13:;
+        __pyx_L16:;
       }
-      __pyx_L12:;
+      __pyx_L15:;
     }
-    __pyx_L9:;
-    goto __pyx_L7;
+    __pyx_L12:;
+    goto __pyx_L10;
   }
   /*else*/ {
 
@@ -10569,9 +9964,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L14;
+      goto __pyx_L17;
     }
-    __pyx_L14:;
+    __pyx_L17:;
 
     /* "csamtools.pyx":959
  *                 raise ValueError ("fetching by region is not available for sam files" )
@@ -10595,9 +9990,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L15;
+      goto __pyx_L18;
     }
-    __pyx_L15:;
+    __pyx_L18:;
 
     /* "csamtools.pyx":962
  *                 raise NotImplementedError( "callback not implemented yet" )
@@ -10606,7 +10001,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  *                 raise ValueError( "fetch called for samfile without header")
  * 
  */
-    __pyx_t_3 = (__pyx_v_self->samfile->header == NULL);
+    __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL);
     if (__pyx_t_3) {
 
       /* "csamtools.pyx":963
@@ -10621,9 +10016,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L16;
+      goto __pyx_L19;
     }
-    __pyx_L16:;
+    __pyx_L19:;
 
     /* "csamtools.pyx":967
  *             # check if targets are defined
@@ -10632,7 +10027,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  *                 warnings.warn( "fetch called for samfile without header")
  * 
  */
-    __pyx_t_3 = (__pyx_v_self->samfile->header->n_targets == 0);
+    __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
     if (__pyx_t_3) {
 
       /* "csamtools.pyx":968
@@ -10651,9 +10046,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      goto __pyx_L17;
+      goto __pyx_L20;
     }
-    __pyx_L17:;
+    __pyx_L20:;
 
     /* "csamtools.pyx":970
  *                 warnings.warn( "fetch called for samfile without header")
@@ -10664,17 +10059,17 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
  */
     __Pyx_XDECREF(__pyx_r);
     __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_INCREF(((PyObject *)__pyx_v_self));
-    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self));
-    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_INCREF(__pyx_v_self);
+    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
+    __Pyx_GIVEREF(__pyx_v_self);
     __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
@@ -10682,7 +10077,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
     __pyx_t_7 = 0;
     goto __pyx_L0;
   }
-  __pyx_L7:;
+  __pyx_L10:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -10702,23 +10097,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_23mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_22mate[] = "Samfile.mate(self, AlignedRead read)\nreturn the mate of :class:`AlignedRead` *read*.\n\n        Throws a ValueError if read is unpaired or the mate\n        is unmapped.\n\n        .. note::\n            Calling this method will change the file position.\n            This might interfere with any iterators that have\n            not re-opened the file.\n\n        ";
-static PyObject *__pyx_pw_9csamtools_7Samfile_23mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("mate (wrapper)", 0);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_22mate(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read));
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":972
  *             return IteratorRowAll( self, reopen=reopen )
  * 
@@ -10727,7 +10105,9 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_23mate(PyObject *__pyx_v_self, PyO
  *         '''return the mate of :class:`AlignedRead` *read*.
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_11mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_11mate[] = "Samfile.mate(self, AlignedRead read)\nreturn the mate of :class:`AlignedRead` *read*.\n\n        Throws a ValueError if read is unpaired or the mate\n        is unmapped.\n\n        .. note::\n            Calling this method will change the file position.\n            This might interfere with any iterators that have\n            not re-opened the file.\n\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_11mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
   uint32_t __pyx_v_flag;
   __pyx_t_9csamtools_MateData __pyx_v_mate_data;
   int __pyx_v_x;
@@ -10741,8 +10121,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("mate", 0);
+  __Pyx_RefNannySetupContext("mate");
   __Pyx_TraceCall("mate", __pyx_f[0], 972);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":985
  * 
@@ -10751,7 +10132,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
  * 
  *         if flag & BAM_FPAIRED == 0:
  */
-  __pyx_v_flag = __pyx_v_read->_delegate->core.flag;
+  __pyx_v_flag = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.flag;
 
   /* "csamtools.pyx":987
  *         cdef uint32_t flag = read._delegate.core.flag
@@ -10770,13 +10151,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
  *         if flag & BAM_FMUNMAP != 0:
  *             raise ValueError( "mate %s: is unmapped" % (read.qname))
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_read), __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_69), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
@@ -10786,9 +10167,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":989
  *         if flag & BAM_FPAIRED == 0:
@@ -10807,13 +10188,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
  * 
  *         cdef MateData mate_data
  */
-    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_read), __pyx_n_s__qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
     __pyx_t_2 = 0;
@@ -10823,9 +10204,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":994
  *         cdef MateData mate_data
@@ -10834,7 +10215,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
  *         mate_data.mate = NULL
  *         # xor flags to get the other mate
  */
-  __pyx_v_mate_data.name = ((char *)bam1_qname(__pyx_v_read->_delegate));
+  __pyx_v_mate_data.name = ((char *)bam1_qname(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate));
 
   /* "csamtools.pyx":995
  * 
@@ -10870,7 +10251,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
  * 
  *         if mate_data.mate == NULL:
  */
-  bam_fetch(__pyx_v_self->samfile->x.bam, __pyx_v_self->index, __pyx_v_read->_delegate->core.mtid, __pyx_v_read->_delegate->core.mpos, (__pyx_v_read->_delegate->core.mpos + 1), ((void *)(&__pyx_v_mate_data)), __pyx_f_9csamtools_mate_callback);
+  bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mtid, ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mpos, (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mpos + 1), ((void *)(&__pyx_v_mate_data)), __pyx_f_9csamtools_mate_callback);
 
   /* "csamtools.pyx":1008
  *                   mate_callback )
@@ -10894,9 +10275,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L5;
+    goto __pyx_L7;
   }
-  __pyx_L5:;
+  __pyx_L7:;
 
   /* "csamtools.pyx":1011
  *             raise ValueError( "mate not found" )
@@ -10947,19 +10328,49 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_24count[] = "Samfile.count(self, reference=None, start=None, end=None, region=None, until_eof=False)\n*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*\n\n        count  reads :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n        Note that a :term:`TAM` file does not [...]
-static PyObject *__pyx_pw_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1015
+ *         return dest
+ * 
+ *     def count( self,             # <<<<<<<<<<<<<<
+ *                reference = None,
+ *                start = None,
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_12count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_12count[] = "Samfile.count(self, reference=None, start=None, end=None, region=None, until_eof=False)\n*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*\n\n        count  reads :term:`region` using 0-based indexing. The region is specified by\n        :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n        Note that a :term:`TAM` file does not [...]
+static PyObject *__pyx_pf_9csamtools_7Samfile_12count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_region = 0;
   PyObject *__pyx_v_until_eof = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__until_eof,0};
-  PyObject *__pyx_r = 0;
+  int __pyx_v_rtid;
+  int __pyx_v_rstart;
+  int __pyx_v_rend;
+  int __pyx_v_counter;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("count (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *(*__pyx_t_9)(PyObject *);
+  int __pyx_t_10;
+  int __pyx_t_11;
+  int __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_t_14;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__until_eof,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("count");
+  __Pyx_TraceCall("count", __pyx_f[0], 1015);
   {
     PyObject* values[5] = {0,0,0,0,0};
 
@@ -11001,8 +10412,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, Py
     values[4] = __pyx_k_73;
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -11012,7 +10422,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, Py
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         if (kw_args > 0) {
           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
@@ -11040,7 +10450,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, Py
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -11067,46 +10477,6 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, Py
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_24count(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_until_eof);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":1015
- *         return dest
- * 
- *     def count( self,             # <<<<<<<<<<<<<<
- *                reference = None,
- *                start = None,
- */
-
-static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_until_eof) {
-  int __pyx_v_rtid;
-  int __pyx_v_rstart;
-  int __pyx_v_rend;
-  int __pyx_v_counter;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *(*__pyx_t_9)(PyObject *);
-  int __pyx_t_10;
-  int __pyx_t_11;
-  int __pyx_t_12;
-  int __pyx_t_13;
-  int __pyx_t_14;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("count", 0);
-  __Pyx_TraceCall("count", __pyx_f[0], 1015);
   __Pyx_INCREF(__pyx_v_region);
 
   /* "csamtools.pyx":1033
@@ -11116,7 +10486,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -11138,9 +10508,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1036
  *             raise ValueError( "I/O operation on closed file" )
@@ -11149,10 +10519,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
  * 
  *         cdef int counter
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_reference);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
@@ -11203,23 +10573,23 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-    index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
+    index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_1);
-    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
+    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_2);
-    index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
+    index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_6);
-    index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
+    index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_7);
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    goto __pyx_L5_unpacking_done;
-    __pyx_L4_unpacking_failed:;
+    goto __pyx_L8_unpacking_done;
+    __pyx_L7_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
     if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_L5_unpacking_done:;
+    __pyx_L8_unpacking_done:;
   }
   __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -11250,7 +10620,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )
  */
-  if (__pyx_v_self->isbam) {
+  if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
 
     /* "csamtools.pyx":1042
  * 
@@ -11262,7 +10632,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = (!__pyx_t_4);
     if (__pyx_t_3) {
-      __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
@@ -11271,7 +10641,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_13 = (!__pyx_t_4);
       if (__pyx_t_13) {
-        __pyx_t_4 = (!__pyx_v_self->isremote);
+        __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
         __pyx_t_14 = __pyx_t_4;
       } else {
         __pyx_t_14 = __pyx_t_13;
@@ -11294,9 +10664,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
       __Pyx_Raise(__pyx_t_7, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L7;
+      goto __pyx_L10;
     }
-    __pyx_L7:;
+    __pyx_L10:;
 
     /* "csamtools.pyx":1045
  *                 raise ValueError( "fetch called on bamfile without index" )
@@ -11321,9 +10691,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
       __Pyx_Raise(__pyx_t_7, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L8;
+      goto __pyx_L11;
     }
-    __pyx_L8:;
+    __pyx_L11:;
 
     /* "csamtools.pyx":1047
  *             if not region:
@@ -11332,7 +10702,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
  *             bam_fetch(self.samfile.x.bam,
  *                              self.index,
  */
-    __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
@@ -11346,9 +10716,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L9;
+      goto __pyx_L12;
     }
-    __pyx_L9:;
+    __pyx_L12:;
 
     /* "csamtools.pyx":1054
  *                              rend,
@@ -11357,7 +10727,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
  *             return counter
  *         else:
  */
-    bam_fetch(__pyx_v_self->samfile->x.bam, __pyx_v_self->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)(&__pyx_v_counter)), __pyx_f_9csamtools_count_callback);
+    bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)(&__pyx_v_counter)), __pyx_f_9csamtools_count_callback);
 
     /* "csamtools.pyx":1055
  *                              <void*>&counter,
@@ -11372,7 +10742,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
     __pyx_r = __pyx_t_5;
     __pyx_t_5 = 0;
     goto __pyx_L0;
-    goto __pyx_L6;
+    goto __pyx_L9;
   }
   /*else*/ {
 
@@ -11389,7 +10759,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_L6:;
+  __pyx_L9:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -11410,20 +10780,50 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_26pileup[] = "Samfile.pileup(self, reference=None, start=None, end=None, region=None, callback=None, **kwargs)\n\n        perform a :term:`pileup` within a :term:`region`. The region is specified by\n        :term:`reference`, *start* and *end* (using 0-based indexing).\n        Alternatively, a samtools *region* string can be supplied.\n\n        Without *reference* or *region* all reads will be used for the pileup. The reads will be returned\n  [...]
-static PyObject *__pyx_pw_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1059
+ *             raise ValueError ("count for a region is not available for sam files" )
+ * 
+ *     def pileup( self,             # <<<<<<<<<<<<<<
+ *                 reference = None,
+ *                 start = None,
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_13pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_13pileup[] = "Samfile.pileup(self, reference=None, start=None, end=None, region=None, callback=None, **kwargs)\n\n        perform a :term:`pileup` within a :term:`region`. The region is specified by\n        :term:`reference`, *start* and *end* (using 0-based indexing).\n        Alternatively, a samtools *region* string can be supplied.\n\n        Without *reference* or *region* all reads will be used for the pileup. The reads will be returned\n  [...]
+static PyObject *__pyx_pf_9csamtools_7Samfile_13pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_reference = 0;
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_region = 0;
   PyObject *__pyx_v_callback = 0;
   PyObject *__pyx_v_kwargs = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,0};
-  PyObject *__pyx_r = 0;
+  int __pyx_v_rtid;
+  int __pyx_v_rstart;
+  int __pyx_v_rend;
+  int __pyx_v_has_coord;
+  bam_plbuf_t *__pyx_v_buf;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("pileup (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *(*__pyx_t_9)(PyObject *);
+  int __pyx_t_10;
+  int __pyx_t_11;
+  int __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("pileup");
+  __Pyx_TraceCall("pileup", __pyx_f[0], 1059);
   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
   __Pyx_GOTREF(__pyx_v_kwargs);
   {
@@ -11475,8 +10875,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, P
     values[4] = ((PyObject *)Py_None);
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -11486,7 +10885,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, P
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         if (kw_args > 0) {
           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
@@ -11514,7 +10913,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, P
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "pileup") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "pileup") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -11542,47 +10941,6 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, P
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_26pileup(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_callback, __pyx_v_kwargs);
-  __Pyx_XDECREF(__pyx_v_kwargs);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":1059
- *             raise ValueError ("count for a region is not available for sam files" )
- * 
- *     def pileup( self,             # <<<<<<<<<<<<<<
- *                 reference = None,
- *                 start = None,
- */
-
-static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_callback, PyObject *__pyx_v_kwargs) {
-  int __pyx_v_rtid;
-  int __pyx_v_rstart;
-  int __pyx_v_rend;
-  int __pyx_v_has_coord;
-  bam_plbuf_t *__pyx_v_buf;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *(*__pyx_t_9)(PyObject *);
-  int __pyx_t_10;
-  int __pyx_t_11;
-  int __pyx_t_12;
-  int __pyx_t_13;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("pileup", 0);
-  __Pyx_TraceCall("pileup", __pyx_f[0], 1059);
 
   /* "csamtools.pyx":1115
  *         cdef bam_plbuf_t *buf
@@ -11591,7 +10949,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  *             raise ValueError( "I/O operation on closed file" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -11613,9 +10971,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1118
  *             raise ValueError( "I/O operation on closed file" )
@@ -11624,10 +10982,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  * 
  *         if self.isbam:
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_reference);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
   __Pyx_GIVEREF(__pyx_v_reference);
@@ -11678,23 +11036,23 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-    index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
+    index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_1);
-    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
+    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_2);
-    index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
+    index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_6);
-    index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
+    index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_7);
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    goto __pyx_L5_unpacking_done;
-    __pyx_L4_unpacking_failed:;
+    goto __pyx_L8_unpacking_done;
+    __pyx_L7_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
     if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_L5_unpacking_done:;
+    __pyx_L8_unpacking_done:;
   }
   __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -11716,7 +11074,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  *             if not self._hasIndex(): raise ValueError( "no index available for pileup" )
  * 
  */
-  if (__pyx_v_self->isbam) {
+  if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
 
     /* "csamtools.pyx":1121
  * 
@@ -11725,7 +11083,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  * 
  *             if callback:
  */
-    __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
@@ -11739,9 +11097,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
       __Pyx_Raise(__pyx_t_7, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L7;
+      goto __pyx_L10;
     }
-    __pyx_L7:;
+    __pyx_L10:;
 
     /* "csamtools.pyx":1123
  *             if not self._hasIndex(): raise ValueError( "no index available for pileup" )
@@ -11767,9 +11125,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
         __Pyx_Raise(__pyx_t_7, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L9;
+        goto __pyx_L12;
       }
-      __pyx_L9:;
+      __pyx_L12:;
 
       /* "csamtools.pyx":1126
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
@@ -11787,7 +11145,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  * 
  *                 # finalize pileup
  */
-      bam_fetch(__pyx_v_self->samfile->x.bam, __pyx_v_self->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, __pyx_v_buf, __pyx_f_9csamtools_pileup_fetch_callback);
+      bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, __pyx_v_buf, __pyx_f_9csamtools_pileup_fetch_callback);
 
       /* "csamtools.pyx":1132
  * 
@@ -11806,7 +11164,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  *                 if has_coord:
  */
       bam_plbuf_destroy(__pyx_v_buf);
-      goto __pyx_L8;
+      goto __pyx_L11;
     }
     /*else*/ {
 
@@ -11828,19 +11186,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  */
         __Pyx_XDECREF(__pyx_r);
         __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_INCREF(((PyObject *)__pyx_v_self));
-        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
-
-        /* "csamtools.pyx":1140
- *                                                  start = rstart,
- *                                                  end = rend,
- *                                                  **kwargs )             # <<<<<<<<<<<<<<
- *                 else:
- *                     return IteratorColumnAllRefs(self, **kwargs )
- */
-        __pyx_t_5 = PyDict_Copy(((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+        __Pyx_INCREF(__pyx_v_self);
+        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
+        __Pyx_GIVEREF(__pyx_v_self);
+        __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
 
         /* "csamtools.pyx":1137
@@ -11852,9 +11202,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  */
         __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        if (unlikely(PyDict_GetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__tid)))) {
-          __Pyx_RaiseDoubleKeywordsError("function", ((PyObject *)__pyx_n_s__tid)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__tid), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
@@ -11867,9 +11214,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  */
         __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        if (unlikely(PyDict_GetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__start)))) {
-          __Pyx_RaiseDoubleKeywordsError("function", ((PyObject *)__pyx_n_s__start)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__start), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
@@ -11882,19 +11226,25 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  */
         __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
-        if (unlikely(PyDict_GetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__end)))) {
-          __Pyx_RaiseDoubleKeywordsError("function", ((PyObject *)__pyx_n_s__end)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
         if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__end), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnRegion)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+        /* "csamtools.pyx":1140
+ *                                                  start = rstart,
+ *                                                  end = rend,
+ *                                                  **kwargs )             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     return IteratorColumnAllRefs(self, **kwargs )
+ */
+        if (PyDict_Update(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_v_kwargs)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnRegion)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
         __pyx_r = __pyx_t_6;
         __pyx_t_6 = 0;
         goto __pyx_L0;
-        goto __pyx_L10;
+        goto __pyx_L13;
       }
       /*else*/ {
 
@@ -11907,24 +11257,21 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  */
         __Pyx_XDECREF(__pyx_r);
         __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
-        __Pyx_INCREF(((PyObject *)__pyx_v_self));
-        PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
-        __pyx_t_5 = ((PyObject *)__pyx_v_kwargs);
-        __Pyx_INCREF(__pyx_t_5);
-        __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnAllRefs)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+        __Pyx_INCREF(__pyx_v_self);
+        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
+        __Pyx_GIVEREF(__pyx_v_self);
+        __pyx_t_5 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnAllRefs)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-        __pyx_r = __pyx_t_7;
-        __pyx_t_7 = 0;
+        __pyx_r = __pyx_t_5;
+        __pyx_t_5 = 0;
         goto __pyx_L0;
       }
-      __pyx_L10:;
+      __pyx_L13:;
     }
-    __pyx_L8:;
-    goto __pyx_L6;
+    __pyx_L11:;
+    goto __pyx_L9;
   }
   /*else*/ {
 
@@ -11935,13 +11282,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
  * 
  *     def close( self ):
  */
-    __pyx_t_7 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_5 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_L6:;
+  __pyx_L9:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -11955,24 +11302,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtoo
   __Pyx_AddTraceback("csamtools.Samfile.pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_kwargs);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_TraceReturn(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_29close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_28close[] = "Samfile.close(self)\n\n        closes the :class:`pysam.Samfile`.";
-static PyObject *__pyx_pw_9csamtools_7Samfile_29close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("close (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_28close(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1147
  *             raise NotImplementedError( "pileup of samfiles not implemented yet" )
  * 
@@ -11981,12 +11317,14 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_29close(PyObject *__pyx_v_self, CY
  *         closes the :class:`pysam.Samfile`.'''
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_14close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_14close[] = "Samfile.close(self)\n\n        closes the :class:`pysam.Samfile`.";
+static PyObject *__pyx_pf_9csamtools_7Samfile_14close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("close", 0);
+  __Pyx_RefNannySetupContext("close");
   __Pyx_TraceCall("close", __pyx_f[0], 1147);
 
   /* "csamtools.pyx":1150
@@ -11996,7 +11334,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtool
  *             samclose( self.samfile )
  *             bam_index_destroy(self.index);
  */
-  __pyx_t_1 = (__pyx_v_self->samfile != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL);
   if (__pyx_t_1) {
 
     /* "csamtools.pyx":1151
@@ -12006,7 +11344,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtool
  *             bam_index_destroy(self.index);
  *             self.samfile = NULL
  */
-    samclose(__pyx_v_self->samfile);
+    samclose(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile);
 
     /* "csamtools.pyx":1152
  *         if self.samfile != NULL:
@@ -12015,7 +11353,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtool
  *             self.samfile = NULL
  * 
  */
-    bam_index_destroy(__pyx_v_self->index);
+    bam_index_destroy(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index);
 
     /* "csamtools.pyx":1153
  *             samclose( self.samfile )
@@ -12024,10 +11362,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtool
  * 
  *     def __dealloc__( self ):
  */
-    __pyx_v_self->samfile = NULL;
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   __Pyx_XGIVEREF(__pyx_r);
@@ -12036,15 +11374,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_9csamtools_7Samfile_31__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_9csamtools_7Samfile_31__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_9csamtools_7Samfile_30__dealloc__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
 /* "csamtools.pyx":1155
  *             self.samfile = NULL
  * 
@@ -12053,7 +11382,8 @@ static void __pyx_pw_9csamtools_7Samfile_31__dealloc__(PyObject *__pyx_v_self) {
  *         # note: no doc string
  */
 
-static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static void __pyx_pf_9csamtools_7Samfile_15__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_7Samfile_15__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -12062,7 +11392,7 @@ static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtoo
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__", 0);
+  __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1155);
 
   /* "csamtools.pyx":1159
@@ -12072,7 +11402,7 @@ static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtoo
  *         bam_destroy1(self.b)
  *         if self._filename != NULL: free( self._filename )
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -12086,7 +11416,7 @@ static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtoo
  *         if self._filename != NULL: free( self._filename )
  * 
  */
-  bam_destroy1(__pyx_v_self->b);
+  bam_destroy1(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b);
 
   /* "csamtools.pyx":1161
  *         self.close()
@@ -12095,12 +11425,12 @@ static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtoo
  * 
  *     cpdef int write( self, AlignedRead read ) except -1:
  */
-  __pyx_t_3 = (__pyx_v_self->_filename != NULL);
+  __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename != NULL);
   if (__pyx_t_3) {
-    free(__pyx_v_self->_filename);
-    goto __pyx_L3;
+    free(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename);
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   goto __pyx_L0;
   __pyx_L1_error:;
@@ -12120,7 +11450,7 @@ static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtoo
  *         write a single :class:`pysam.AlignedRead` to disk.
  */
 
-static PyObject *__pyx_pw_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
 static int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read, int __pyx_skip_dispatch) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
@@ -12134,7 +11464,7 @@ static int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfile
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("write", 0);
+  __Pyx_RefNannySetupContext("write");
   __Pyx_TraceCall("write", __pyx_f[0], 1163);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
@@ -12142,9 +11472,9 @@ static int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfile
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
     __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_9csamtools_7Samfile_33write)) {
+    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_9csamtools_7Samfile_16write)) {
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(((PyObject *)__pyx_v_read));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_read));
       __Pyx_GIVEREF(((PyObject *)__pyx_v_read));
@@ -12214,23 +11544,6 @@ static int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfile
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_32write[] = "Samfile.write(self, AlignedRead read) -> int\n\n        write a single :class:`pysam.AlignedRead` to disk.\n\n        returns the number of bytes written.\n        ";
-static PyObject *__pyx_pw_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("write (wrapper)", 0);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_32write(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read));
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1163
  *         if self._filename != NULL: free( self._filename )
  * 
@@ -12239,7 +11552,9 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, Py
  *         write a single :class:`pysam.AlignedRead` to disk.
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_32write(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_16write[] = "Samfile.write(self, AlignedRead read) -> int\n\n        write a single :class:`pysam.AlignedRead` to disk.\n\n        returns the number of bytes written.\n        ";
+static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -12247,10 +11562,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_32write(struct __pyx_obj_9csamtool
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("write", 0);
+  __Pyx_RefNannySetupContext("write");
   __Pyx_TraceCall("write", __pyx_f[0], 1163);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_9csamtools_Samfile *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, __pyx_v_read, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_9csamtools_Samfile *)((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->__pyx_vtab)->write(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -12269,18 +11585,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_32write(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_35__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_34__enter__[] = "Samfile.__enter__(self)";
-static PyObject *__pyx_pw_9csamtools_7Samfile_35__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_34__enter__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1174
  *         return samwrite( self.samfile, read._delegate )
  * 
@@ -12289,11 +11593,13 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_35__enter__(PyObject *__pyx_v_self
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_34__enter__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_17__enter__[] = "Samfile.__enter__(self)";
+static PyObject *__pyx_pf_9csamtools_7Samfile_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__enter__", 0);
+  __Pyx_RefNannySetupContext("__enter__");
   __Pyx_TraceCall("__enter__", __pyx_f[0], 1174);
 
   /* "csamtools.pyx":1175
@@ -12304,8 +11610,8 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_34__enter__(struct __pyx_obj_9csam
  *     def __exit__(self, exc_type, exc_value, traceback):
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self));
-  __pyx_r = ((PyObject *)__pyx_v_self);
+  __Pyx_INCREF(__pyx_v_self);
+  __pyx_r = __pyx_v_self;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -12316,23 +11622,36 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_34__enter__(struct __pyx_obj_9csam
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_37__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_36__exit__[] = "Samfile.__exit__(self, exc_type, exc_value, traceback)";
-static PyObject *__pyx_pw_9csamtools_7Samfile_37__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
-  CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
-  CYTHON_UNUSED PyObject *__pyx_v_traceback = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__exc_type,&__pyx_n_s__exc_value,&__pyx_n_s__traceback,0};
-  PyObject *__pyx_r = 0;
+/* "csamtools.pyx":1177
+ *         return self
+ * 
+ *     def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
+ *         self.close()
+ *         return False
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_18__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_18__exit__[] = "Samfile.__exit__(self, exc_type, exc_value, traceback)";
+static PyObject *__pyx_pf_9csamtools_7Samfile_18__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_exc_type = 0;
+  PyObject *__pyx_v_exc_value = 0;
+  PyObject *__pyx_v_traceback = 0;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__exc_type,&__pyx_n_s__exc_value,&__pyx_n_s__traceback,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__exit__");
+  __Pyx_TraceCall("__exit__", __pyx_f[0], 1177);
   {
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
@@ -12340,7 +11659,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_37__exit__(PyObject *__pyx_v_self,
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_type);
         if (likely(values[0])) kw_args--;
@@ -12359,7 +11678,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_37__exit__(PyObject *__pyx_v_self,
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
       goto __pyx_L5_argtuple_error;
@@ -12380,30 +11699,6 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_37__exit__(PyObject *__pyx_v_self,
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_36__exit__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_traceback);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":1177
- *         return self
- * 
- *     def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
- *         self.close()
- *         return False
- */
-
-static PyObject *__pyx_pf_9csamtools_7Samfile_36__exit__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__exit__", 0);
-  __Pyx_TraceCall("__exit__", __pyx_f[0], 1177);
 
   /* "csamtools.pyx":1178
  * 
@@ -12412,7 +11707,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_36__exit__(struct __pyx_obj_9csamt
  *         return False
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -12447,17 +11742,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_36__exit__(struct __pyx_obj_9csamt
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_8filename_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_8filename___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1188
  *     property filename:
  *         '''number of :term:`filename` associated with this object.'''
@@ -12466,7 +11750,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_8filename_1__get__(PyObject *__pyx
  *             return self._filename
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -12477,7 +11762,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1188);
 
   /* "csamtools.pyx":1189
@@ -12487,7 +11772,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj
  *             return self._filename
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -12501,9 +11786,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1190
  *         def __get__(self):
@@ -12513,7 +11798,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj
  *     property nreferences:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyBytes_FromString(__pyx_v_self->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_r = ((PyObject *)__pyx_t_2);
   __pyx_t_2 = 0;
@@ -12533,17 +11818,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_11nreferences_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_11nreferences_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_11nreferences___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1194
  *     property nreferences:
  *         '''number of :term:`reference` sequences in the file.'''
@@ -12552,7 +11826,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_11nreferences_1__get__(PyObject *_
  *             return self.samfile.header.n_targets
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -12563,7 +11838,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1194);
 
   /* "csamtools.pyx":1195
@@ -12573,7 +11848,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx
  *             return self.samfile.header.n_targets
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -12587,9 +11862,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1196
  *         def __get__(self):
@@ -12599,7 +11874,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx
  *     property references:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -12619,17 +11894,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_10references_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_10references_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_10references___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1200
  *     property references:
  *         """tuple with the names of :term:`reference` sequences."""
@@ -12638,7 +11902,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_10references_1__get__(PyObject *__
  *             t = []
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_v_t = NULL;
   long __pyx_v_x;
   PyObject *__pyx_r = NULL;
@@ -12653,7 +11918,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1200);
 
   /* "csamtools.pyx":1201
@@ -12663,7 +11928,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -12677,9 +11942,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1202
  *         def __get__(self):
@@ -12689,7 +11954,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_
  *                 t.append( _charptr_to_str(self.samfile.header.target_name[x]) )
  */
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_v_t = __pyx_t_2;
   __pyx_t_2 = 0;
 
@@ -12700,7 +11965,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_
  *                 t.append( _charptr_to_str(self.samfile.header.target_name[x]) )
  *             return tuple(t)
  */
-  __pyx_t_5 = __pyx_v_self->samfile->header->n_targets;
+  __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) {
 
     /* "csamtools.pyx":1204
@@ -12710,7 +11975,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_
  *             return tuple(t)
  * 
  */
-    __pyx_t_2 = __pyx_f_9csamtools__charptr_to_str((__pyx_v_self->samfile->header->target_name[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(((PyObject *)__pyx_v_t) == Py_None)) {
+      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
+    __pyx_t_2 = __pyx_f_9csamtools__charptr_to_str((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_6 = PyList_Append(__pyx_v_t, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -12724,6 +11992,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_
  *     property lengths:
  */
   __Pyx_XDECREF(__pyx_r);
+  if (unlikely(((PyObject *)__pyx_v_t) == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
   __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_r = ((PyObject *)__pyx_t_2);
@@ -12745,17 +12016,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_7lengths_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_7lengths_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_7lengths___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1211
  *         :attr:`pysam.Samfile.references`
  *         """
@@ -12764,7 +12024,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_7lengths_1__get__(PyObject *__pyx_
  *             t = []
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_v_t = NULL;
   long __pyx_v_x;
   PyObject *__pyx_r = NULL;
@@ -12779,7 +12040,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1211);
 
   /* "csamtools.pyx":1212
@@ -12789,7 +12050,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -12803,9 +12064,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1213
  *         def __get__(self):
@@ -12815,7 +12076,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_
  *                 t.append( self.samfile.header.target_len[x] )
  */
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_v_t = __pyx_t_2;
   __pyx_t_2 = 0;
 
@@ -12826,7 +12087,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_
  *                 t.append( self.samfile.header.target_len[x] )
  *             return tuple(t)
  */
-  __pyx_t_5 = __pyx_v_self->samfile->header->n_targets;
+  __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) {
 
     /* "csamtools.pyx":1215
@@ -12836,7 +12097,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_
  *             return tuple(t)
  * 
  */
-    __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t((__pyx_v_self->samfile->header->target_len[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(((PyObject *)__pyx_v_t) == Py_None)) {
+      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
+    __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_len[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_6 = PyList_Append(__pyx_v_t, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -12850,6 +12114,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_
  *     property mapped:
  */
   __Pyx_XDECREF(__pyx_r);
+  if (unlikely(((PyObject *)__pyx_v_t) == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
   __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_r = ((PyObject *)__pyx_t_2);
@@ -12871,17 +12138,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_6mapped_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_6mapped_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_6mapped___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1221
  *         """total number of mapped reads in file.
  *         """
@@ -12890,7 +12146,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_6mapped_1__get__(PyObject *__pyx_v
  *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(PyObject *__pyx_v_self) {
   int __pyx_v_tid;
   uint32_t __pyx_v_total;
   PyObject *__pyx_r = NULL;
@@ -12904,7 +12161,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1221);
 
   /* "csamtools.pyx":1222
@@ -12914,7 +12171,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9
  *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -12928,9 +12185,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1223
  *         def __get__(self):
@@ -12939,16 +12196,16 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9
  * 
  *             cdef int tid
  */
-  __pyx_t_4 = (!__pyx_v_self->isbam);
+  __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
   if (__pyx_t_4) {
     __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_93), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1226
  * 
@@ -12966,7 +12223,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9
  *                 total += pysam_get_mapped( self.index, tid )
  *             return total
  */
-  __pyx_t_5 = __pyx_v_self->samfile->header->n_targets;
+  __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
   for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) {
 
     /* "csamtools.pyx":1228
@@ -12976,7 +12233,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9
  *             return total
  * 
  */
-    __pyx_v_total = (__pyx_v_total + pysam_get_mapped(__pyx_v_self->index, __pyx_v_tid));
+    __pyx_v_total = (__pyx_v_total + pysam_get_mapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_tid));
   }
 
   /* "csamtools.pyx":1229
@@ -13007,17 +12264,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_8unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_8unmapped_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_8unmapped___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1234
  *         """total number of unmapped reads in file.
  *         """
@@ -13026,7 +12272,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_8unmapped_1__get__(PyObject *__pyx
  *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(PyObject *__pyx_v_self) {
   int __pyx_v_tid;
   uint32_t __pyx_v_total;
   PyObject *__pyx_r = NULL;
@@ -13040,7 +12287,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1234);
 
   /* "csamtools.pyx":1235
@@ -13050,7 +12297,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj
  *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
  *             cdef int tid
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -13064,9 +12311,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1236
  *         def __get__(self):
@@ -13075,16 +12322,16 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj
  *             cdef int tid
  *             cdef uint32_t total = 0
  */
-  __pyx_t_4 = (!__pyx_v_self->isbam);
+  __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
   if (__pyx_t_4) {
     __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1238
  *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
@@ -13102,7 +12349,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj
  *                 total += pysam_get_unmapped( self.index, tid )
  *             # get unmapped reads without coordinates
  */
-  __pyx_t_5 = __pyx_v_self->samfile->header->n_targets;
+  __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
   for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) {
 
     /* "csamtools.pyx":1240
@@ -13112,7 +12359,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj
  *             # get unmapped reads without coordinates
  *             total += pysam_get_unmapped( self.index, -1 )
  */
-    __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(__pyx_v_self->index, __pyx_v_tid));
+    __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_tid));
   }
 
   /* "csamtools.pyx":1242
@@ -13122,7 +12369,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj
  *             return total
  * 
  */
-  __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(__pyx_v_self->index, -1));
+  __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, -1));
 
   /* "csamtools.pyx":1243
  *             # get unmapped reads without coordinates
@@ -13152,17 +12399,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_4text_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_4text___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1247
  *     property text:
  *         '''full contents of the :term:`sam file` header as a string.'''
@@ -13171,7 +12407,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_4text_1__get__(PyObject *__pyx_v_s
  *             return from_string_and_size(self.samfile.header.text, self.samfile.header.l_text)
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -13182,7 +12419,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1247);
 
   /* "csamtools.pyx":1248
@@ -13192,7 +12429,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9cs
  *             return from_string_and_size(self.samfile.header.text, self.samfile.header.l_text)
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -13206,9 +12443,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9cs
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1249
  *         def __get__(self):
@@ -13218,7 +12455,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9cs
  *     property header:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __pyx_f_9csamtools_from_string_and_size(__pyx_v_self->samfile->header->text, __pyx_v_self->samfile->header->l_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_from_string_and_size(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->l_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -13238,17 +12475,6 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_6header_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_6header___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1255
  *         a two-level dictionary.
  *         '''
@@ -13257,7 +12483,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_6header_1__get__(PyObject *__pyx_v
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_v_result = NULL;
   PyObject *__pyx_v_t = NULL;
   PyObject *__pyx_v_line = NULL;
@@ -13290,7 +12517,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1255);
 
   /* "csamtools.pyx":1256
@@ -13300,7 +12527,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  * 
  *             result = {}
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -13314,9 +12541,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1258
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
@@ -13337,7 +12564,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                 # convert to python string (note: call self.text to create 0-terminated string)
  *                 t = self.text
  */
-  __pyx_t_4 = (__pyx_v_self->samfile->header->text != NULL);
+  __pyx_t_4 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text != NULL);
   if (__pyx_t_4) {
 
     /* "csamtools.pyx":1262
@@ -13347,7 +12574,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                 for line in t.split("\n"):
  *                     if not line.strip(): continue
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_v_t = __pyx_t_2;
     __pyx_t_2 = 0;
@@ -13374,10 +12601,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     for (;;) {
-      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) {
+      if (PyList_CheckExact(__pyx_t_2)) {
         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
         __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
+      } else if (PyTuple_CheckExact(__pyx_t_2)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
         __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
       } else {
@@ -13411,10 +12638,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_3 = (!__pyx_t_4);
       if (__pyx_t_3) {
-        goto __pyx_L5_continue;
-        goto __pyx_L7;
+        goto __pyx_L7_continue;
+        goto __pyx_L9;
       }
-      __pyx_L7:;
+      __pyx_L9:;
 
       /* "csamtools.pyx":1265
  *                 for line in t.split("\n"):
@@ -13486,7 +12713,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (unlikely(!__pyx_t_3)) {
         __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
@@ -13519,15 +12746,18 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                         result[record].append( "\t".join( fields[1:] ) )
  *                         continue
  */
+        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_3 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         if (__pyx_t_3) {
           __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
           if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-          goto __pyx_L9;
+          goto __pyx_L11;
         }
-        __pyx_L9:;
+        __pyx_L11:;
 
         /* "csamtools.pyx":1273
  *                     if record == "CO":
@@ -13543,7 +12773,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
         __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_9));
         PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
         __Pyx_GIVEREF(__pyx_t_8);
         __pyx_t_8 = 0;
@@ -13564,10 +12794,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  * 
  *                     # the following is clumsy as generators do not work?
  */
-        goto __pyx_L5_continue;
-        goto __pyx_L8;
+        goto __pyx_L7_continue;
+        goto __pyx_L10;
       }
-      __pyx_L8:;
+      __pyx_L10:;
 
       /* "csamtools.pyx":1277
  * 
@@ -13601,10 +12831,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
       }
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       for (;;) {
-        if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_8)) {
+        if (PyList_CheckExact(__pyx_t_8)) {
           if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_8)) break;
           __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++;
-        } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_8)) {
+        } else if (PyTuple_CheckExact(__pyx_t_8)) {
           if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
           __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++;
         } else {
@@ -13662,19 +12892,19 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
           __Pyx_GOTREF(__pyx_t_12);
           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
           __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
-          index = 0; __pyx_t_9 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed;
+          index = 0; __pyx_t_9 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed;
           __Pyx_GOTREF(__pyx_t_9);
-          index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L12_unpacking_failed;
+          index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L14_unpacking_failed;
           __Pyx_GOTREF(__pyx_t_1);
           if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          goto __pyx_L13_unpacking_done;
-          __pyx_L12_unpacking_failed:;
+          goto __pyx_L15_unpacking_done;
+          __pyx_L14_unpacking_failed:;
           __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
           if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
           if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
           {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_L13_unpacking_done:;
+          __pyx_L15_unpacking_done:;
         }
         __Pyx_XDECREF(__pyx_v_key);
         __pyx_v_key = __pyx_t_9;
@@ -13715,7 +12945,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
           __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
           __Pyx_INCREF(__pyx_v_value);
           PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_value);
           __Pyx_GIVEREF(__pyx_v_value);
@@ -13725,7 +12955,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
           __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
           if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          goto __pyx_L14;
+          goto __pyx_L16;
         }
 
         /* "csamtools.pyx":1284
@@ -13753,7 +12983,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                             raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )
  */
           if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          goto __pyx_L14;
+          goto __pyx_L16;
         }
         /*else*/ {
 
@@ -13765,7 +12995,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                     if VALID_HEADER_TYPES[record] == dict:
  */
           __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
           __Pyx_INCREF(__pyx_v_key);
           PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_key);
           __Pyx_GIVEREF(__pyx_v_key);
@@ -13776,7 +13006,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
           __Pyx_GOTREF(((PyObject *)__pyx_t_9));
           __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
           __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
           PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_9));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
           __pyx_t_9 = 0;
@@ -13787,7 +13017,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
           {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
-        __pyx_L14:;
+        __pyx_L16:;
       }
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
@@ -13817,6 +13047,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )
  *                         result[record] = x
  */
+        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_4 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         if (__pyx_t_4) {
 
@@ -13830,7 +13063,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
           __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_108), __pyx_v_record); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_8));
           __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_9));
           PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
           __pyx_t_8 = 0;
@@ -13840,9 +13073,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
           __Pyx_Raise(__pyx_t_8, 0, 0, 0);
           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
           {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          goto __pyx_L16;
+          goto __pyx_L18;
         }
-        __pyx_L16:;
+        __pyx_L18:;
 
         /* "csamtools.pyx":1292
  *                         if record in result:
@@ -13852,7 +13085,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                         if record not in result: result[record] = []
  */
         if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_v_x)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L15;
+        goto __pyx_L17;
       }
 
       /* "csamtools.pyx":1293
@@ -13881,15 +13114,18 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                         result[record].append( x )
  * 
  */
+        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         if (__pyx_t_4) {
           __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_8));
           if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-          goto __pyx_L17;
+          goto __pyx_L19;
         }
-        __pyx_L17:;
+        __pyx_L19:;
 
         /* "csamtools.pyx":1295
  *                     elif VALID_HEADER_TYPES[record] == list:
@@ -13904,10 +13140,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
         __Pyx_GOTREF(__pyx_t_9);
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        goto __pyx_L15;
+        goto __pyx_L17;
       }
-      __pyx_L15:;
-      __pyx_L5_continue:;
+      __pyx_L17:;
+      __pyx_L7_continue:;
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -13918,6 +13154,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                     sq = []
  *                     for ref, length in zip( self.references, self.lengths ):
  */
+    if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
     __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_n_s__SQ)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_4) {
 
@@ -13929,7 +13168,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                         sq.append( {'LN': length, 'SN': ref } )
  */
       __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __pyx_v_sq = __pyx_t_2;
       __pyx_t_2 = 0;
 
@@ -13940,12 +13179,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                         sq.append( {'LN': length, 'SN': ref } )
  *                     result["SQ"] = sq
  */
-      __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__references); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__references); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lengths); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lengths); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
       PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
@@ -13965,10 +13204,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
       }
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       for (;;) {
-        if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_8)) {
+        if (PyList_CheckExact(__pyx_t_8)) {
           if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_8)) break;
           __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
-        } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_8)) {
+        } else if (PyTuple_CheckExact(__pyx_t_8)) {
           if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
           __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
         } else {
@@ -14010,19 +13249,19 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
           __Pyx_GOTREF(__pyx_t_1);
           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
           __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext;
-          index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_2)) goto __pyx_L21_unpacking_failed;
+          index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_2)) goto __pyx_L23_unpacking_failed;
           __Pyx_GOTREF(__pyx_t_2);
-          index = 1; __pyx_t_7 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_7)) goto __pyx_L21_unpacking_failed;
+          index = 1; __pyx_t_7 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_7)) goto __pyx_L23_unpacking_failed;
           __Pyx_GOTREF(__pyx_t_7);
           if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          goto __pyx_L22_unpacking_done;
-          __pyx_L21_unpacking_failed:;
+          goto __pyx_L24_unpacking_done;
+          __pyx_L23_unpacking_failed:;
           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
           if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
           if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
           {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_L22_unpacking_done:;
+          __pyx_L24_unpacking_done:;
         }
         __Pyx_XDECREF(__pyx_v_ref);
         __pyx_v_ref = __pyx_t_2;
@@ -14038,6 +13277,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *                     result["SQ"] = sq
  * 
  */
+        if (unlikely(((PyObject *)__pyx_v_sq) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_9));
         if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__LN), __pyx_v_length) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -14055,12 +13297,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
  *             return result
  */
       if (PyDict_SetItem(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_v_sq)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L18;
+      goto __pyx_L20;
     }
-    __pyx_L18:;
-    goto __pyx_L4;
+    __pyx_L20:;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1309
  *                     result["SQ"] = sq
@@ -14104,29 +13346,50 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_39_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_38_buildLine[] = "Samfile._buildLine(self, fields, record)\nbuild a header line from *fields* dictionary for *record*";
-static PyObject *__pyx_pw_9csamtools_7Samfile_39_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1311
+ *             return result
+ * 
+ *     def _buildLine( self, fields, record ):             # <<<<<<<<<<<<<<
+ *         '''build a header line from *fields* dictionary for *record*'''
+ * 
+ */
+
+static PyObject *__pyx_pf_9csamtools_7Samfile_19_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_19_buildLine[] = "Samfile._buildLine(self, fields, record)\nbuild a header line from *fields* dictionary for *record*";
+static PyObject *__pyx_pf_9csamtools_7Samfile_19_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_fields = 0;
   PyObject *__pyx_v_record = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fields,&__pyx_n_s__record,0};
-  PyObject *__pyx_r = 0;
+  PyObject *__pyx_v_line = NULL;
+  PyObject *__pyx_v_key = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_buildLine (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
+  PyObject *__pyx_t_7 = NULL;
+  int __pyx_t_8;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fields,&__pyx_n_s__record,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("_buildLine");
+  __Pyx_TraceCall("_buildLine", __pyx_f[0], 1311);
   {
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fields);
         if (likely(values[0])) kw_args--;
@@ -14139,7 +13402,7 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_39_buildLine(PyObject *__pyx_v_sel
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_buildLine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_buildLine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -14158,38 +13421,6 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_39_buildLine(PyObject *__pyx_v_sel
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_38_buildLine(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_fields, __pyx_v_record);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":1311
- *             return result
- * 
- *     def _buildLine( self, fields, record ):             # <<<<<<<<<<<<<<
- *         '''build a header line from *fields* dictionary for *record*'''
- * 
- */
-
-static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_fields, PyObject *__pyx_v_record) {
-  PyObject *__pyx_v_line = NULL;
-  PyObject *__pyx_v_key = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  PyObject *__pyx_t_7 = NULL;
-  int __pyx_t_8;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_buildLine", 0);
-  __Pyx_TraceCall("_buildLine", __pyx_f[0], 1311);
 
   /* "csamtools.pyx":1315
  * 
@@ -14201,7 +13432,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
   __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_109), __pyx_v_record); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
   __pyx_t_1 = 0;
@@ -14225,8 +13456,11 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
  *         # user tags
  *         elif record.islower():
  */
+    if (unlikely(((PyObject *)__pyx_v_line) == Py_None)) {
+      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
     __pyx_t_4 = PyList_Append(__pyx_v_line, __pyx_v_fields); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
 
   /* "csamtools.pyx":1320
@@ -14253,7 +13487,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
  *         # defined tags
  */
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_fields);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fields);
     __Pyx_GIVEREF(__pyx_v_fields);
@@ -14270,10 +13504,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     for (;;) {
-      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
+      if (PyList_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
         __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
+      } else if (PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
         __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
       } else {
@@ -14298,10 +13532,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
  *         # defined tags
  *         else:
  */
+      if (unlikely(((PyObject *)__pyx_v_line) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_2 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
       __pyx_t_2 = 0;
@@ -14309,7 +13546,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
       __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       __Pyx_INCREF(__pyx_v_key);
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_key);
       __Pyx_GIVEREF(__pyx_v_key);
@@ -14323,7 +13560,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
       __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
   /*else*/ {
 
@@ -14349,10 +13586,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     for (;;) {
-      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
+      if (PyList_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
         __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
+      } else if (PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
         __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
       } else {
@@ -14387,10 +13624,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
  *             # write user fields
  *             for key in fields:
  */
+        if (unlikely(((PyObject *)__pyx_v_line) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_2 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
         __Pyx_GIVEREF(__pyx_t_2);
         __pyx_t_2 = 0;
@@ -14398,7 +13638,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
         __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_key);
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_key);
         __Pyx_GIVEREF(__pyx_v_key);
@@ -14410,9 +13650,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-        goto __pyx_L8;
+        goto __pyx_L11;
       }
-      __pyx_L8:;
+      __pyx_L11:;
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
@@ -14432,10 +13672,10 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
       __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
+      if (PyList_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
         __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
+      } else if (PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
         __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
       } else {
@@ -14477,10 +13717,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
  * 
  *         return "\t".join( line )
  */
+        if (unlikely(((PyObject *)__pyx_v_line) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_7 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         __pyx_t_7 = 0;
@@ -14488,7 +13731,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(__pyx_v_key);
         PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
         __Pyx_GIVEREF(__pyx_v_key);
@@ -14500,13 +13743,13 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
         __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_7)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        goto __pyx_L11;
+        goto __pyx_L14;
       }
-      __pyx_L11:;
+      __pyx_L14:;
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1334
  *                     line.append( "%s:%s" % (key, str(fields[key])))
@@ -14519,7 +13762,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct
   __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
   __Pyx_INCREF(((PyObject *)__pyx_v_line));
   PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_line));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_line));
@@ -14596,7 +13839,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_buildHeader", 0);
+  __Pyx_RefNannySetupContext("_buildHeader");
   __Pyx_TraceCall("_buildHeader", __pyx_f[0], 1336);
 
   /* "csamtools.pyx":1342
@@ -14607,7 +13850,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  *         # check if hash exists
  */
   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_v_lines = __pyx_t_1;
   __pyx_t_1 = 0;
 
@@ -14639,10 +13882,10 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   for (;;) {
-    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
+    if (PyList_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
       __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
-    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
+    } else if (PyTuple_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
       __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
     } else {
@@ -14725,7 +13968,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
         __pyx_t_1 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         __Pyx_INCREF(__pyx_v_record);
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_record);
         __Pyx_GIVEREF(__pyx_v_record);
@@ -14740,7 +13983,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
         __Pyx_GOTREF(((PyObject *)__pyx_t_1));
         __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
         __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
         __pyx_t_1 = 0;
@@ -14771,10 +14014,13 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  *                 else:
  *                     for fields in new_header[record]:
  */
+        if (unlikely(((PyObject *)__pyx_v_lines) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         __Pyx_INCREF(__pyx_v_data);
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_data);
         __Pyx_GIVEREF(__pyx_v_data);
@@ -14810,10 +14056,10 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
         }
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         for (;;) {
-          if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_6)) {
+          if (PyList_CheckExact(__pyx_t_6)) {
             if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
             __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++;
-          } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_6)) {
+          } else if (PyTuple_CheckExact(__pyx_t_6)) {
             if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
             __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++;
           } else {
@@ -14838,10 +14084,13 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  * 
  *         # then: user tags (lower case), sorted alphabetically
  */
+          if (unlikely(((PyObject *)__pyx_v_lines) == Py_None)) {
+            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+          }
           __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_7);
           __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
           __Pyx_INCREF(__pyx_v_fields);
           PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fields);
           __Pyx_GIVEREF(__pyx_v_fields);
@@ -14877,7 +14126,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
   __Pyx_GIVEREF(__pyx_t_6);
   __pyx_t_6 = 0;
@@ -14894,10 +14143,10 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
   }
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   for (;;) {
-    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
+    if (PyList_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
       __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
-    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
+    } else if (PyTuple_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
       __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
     } else {
@@ -14994,10 +14243,13 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  *             else:
  *                 for fields in new_header[record]:
  */
+      if (unlikely(((PyObject *)__pyx_v_lines) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       __Pyx_INCREF(__pyx_v_data);
       PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data);
       __Pyx_GIVEREF(__pyx_v_data);
@@ -15033,10 +14285,10 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
       }
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
       for (;;) {
-        if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_1)) {
+        if (PyList_CheckExact(__pyx_t_1)) {
           if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
           __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++;
-        } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_1)) {
+        } else if (PyTuple_CheckExact(__pyx_t_1)) {
           if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
           __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++;
         } else {
@@ -15061,10 +14313,13 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  * 
  *         text = "\n".join(lines) + "\n"
  */
+        if (unlikely(((PyObject *)__pyx_v_lines) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_11 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_11);
         __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         __Pyx_INCREF(__pyx_v_fields);
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fields);
         __Pyx_GIVEREF(__pyx_v_fields);
@@ -15095,7 +14350,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
   __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_6), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_v_lines));
   PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_lines));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_lines));
@@ -15187,7 +14442,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  *                 try:
  */
     __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
     __pyx_v_seqs = __pyx_t_7;
     __pyx_t_7 = 0;
 
@@ -15210,10 +14465,10 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
     }
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     for (;;) {
-      if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
+      if (PyList_CheckExact(__pyx_t_1)) {
         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
-      } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
+      } else if (PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
       } else {
@@ -15252,12 +14507,15 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  *                 except KeyError:
  *                     raise KeyError( "incomplete sequence information in '%s'" % str(fields))
  */
+          if (unlikely(((PyObject *)__pyx_v_seqs) == Py_None)) {
+            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L22_error;} 
+          }
           __pyx_t_7 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__SN)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
           __Pyx_GOTREF(__pyx_t_7);
           __pyx_t_2 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__LN)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
           __Pyx_GOTREF(__pyx_t_2);
           __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
-          __Pyx_GOTREF(__pyx_t_6);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
           PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
           __Pyx_GIVEREF(__pyx_t_7);
           PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
@@ -15300,7 +14558,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  *             dest.n_targets = len(seqs)
  */
           __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
-          __Pyx_GOTREF(__pyx_t_11);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_11));
           __Pyx_INCREF(__pyx_v_fields);
           PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_fields);
           __Pyx_GIVEREF(__pyx_v_fields);
@@ -15311,7 +14569,7 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
           __Pyx_GOTREF(((PyObject *)__pyx_t_11));
           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
           __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
-          __Pyx_GOTREF(__pyx_t_18);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_18));
           PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_t_11));
           __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
           __pyx_t_11 = 0;
@@ -15349,6 +14607,9 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
  *             dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )
  *             dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
  */
+    if (unlikely(((PyObject *)__pyx_v_seqs) == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
     __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_seqs)); 
     __pyx_v_dest->n_targets = __pyx_t_3;
 
@@ -15528,17 +14789,6 @@ static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_41__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7Samfile_41__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_40__iter__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1411
  *     ## Possible solutions: deprecate or open new file handle
  *     ###############################################################
@@ -15547,7 +14797,8 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_41__iter__(PyObject *__pyx_v_self)
  *         if not self.isbam and self.samfile.header.n_targets == 0:
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_20__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7Samfile_20__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -15559,7 +14810,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamt
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__iter__", 0);
+  __Pyx_RefNannySetupContext("__iter__");
   __Pyx_TraceCall("__iter__", __pyx_f[0], 1411);
 
   /* "csamtools.pyx":1412
@@ -15569,7 +14820,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamt
  *         if not self.isbam and self.samfile.header.n_targets == 0:
  *                 raise NotImplementedError( "can not iterate over samfile without header")
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -15583,9 +14834,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamt
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1413
  *     def __iter__(self):
@@ -15594,9 +14845,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamt
  *                 raise NotImplementedError( "can not iterate over samfile without header")
  *         return self
  */
-  __pyx_t_4 = (!__pyx_v_self->isbam);
+  __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
   if (__pyx_t_4) {
-    __pyx_t_3 = (__pyx_v_self->samfile->header->n_targets == 0);
+    __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
     __pyx_t_5 = __pyx_t_3;
   } else {
     __pyx_t_5 = __pyx_t_4;
@@ -15615,9 +14866,9 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamt
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1415
  *         if not self.isbam and self.samfile.header.n_targets == 0:
@@ -15627,8 +14878,8 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamt
  *     cdef bam1_t * getCurrent( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self));
-  __pyx_r = ((PyObject *)__pyx_v_self);
+  __Pyx_INCREF(__pyx_v_self);
+  __pyx_r = __pyx_v_self;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -15657,7 +14908,7 @@ static bam1_t *__pyx_f_9csamtools_7Samfile_getCurrent(struct __pyx_obj_9csamtool
   bam1_t *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getCurrent", 0);
+  __Pyx_RefNannySetupContext("getCurrent");
   __Pyx_TraceCall("getCurrent", __pyx_f[0], 1417);
 
   /* "csamtools.pyx":1418
@@ -15689,7 +14940,7 @@ static int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfile
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1420);
 
   /* "csamtools.pyx":1425
@@ -15709,19 +14960,6 @@ static int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfile
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7Samfile_43__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_7Samfile_42__next__[] = "\n        python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_7Samfile_42__next__;
-static PyObject *__pyx_pw_9csamtools_7Samfile_43__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7Samfile_42__next__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1427
  *         return samread(self.samfile, self.b)
  * 
@@ -15730,7 +14968,10 @@ static PyObject *__pyx_pw_9csamtools_7Samfile_43__next__(PyObject *__pyx_v_self)
  *         python version of next().
  */
 
-static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7Samfile_21__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_7Samfile_21__next__[] = "\n        python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_7Samfile_21__next__;
+static PyObject *__pyx_pf_9csamtools_7Samfile_21__next__(PyObject *__pyx_v_self) {
   int __pyx_v_ret;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -15740,7 +14981,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamt
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__", 0);
+  __Pyx_RefNannySetupContext("__next__");
   __Pyx_TraceCall("__next__", __pyx_f[0], 1427);
 
   /* "csamtools.pyx":1432
@@ -15750,7 +14991,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamt
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )
  */
-  __pyx_v_ret = samread(__pyx_v_self->samfile, __pyx_v_self->b);
+  __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b);
 
   /* "csamtools.pyx":1433
  *         cdef int ret
@@ -15770,12 +15011,12 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamt
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -15789,7 +15030,7 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamt
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -15804,24 +15045,42 @@ static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamt
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1481
+ *     """
+ * 
+ *     def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ):             # <<<<<<<<<<<<<<
+ * 
+ *         if not samfile._isOpen():
+ */
+
+static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
   int __pyx_v_tid;
   int __pyx_v_beg;
   int __pyx_v_end;
   int __pyx_v_reopen;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__beg,&__pyx_n_s__end,&__pyx_n_s__reopen,0};
+  PyObject *__pyx_v_mode = NULL;
+  PyObject *__pyx_v_store = NULL;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  char *__pyx_t_5;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__beg,&__pyx_n_s__end,&__pyx_n_s__reopen,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__cinit__");
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1481);
   {
     PyObject* values[5] = {0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -15831,7 +15090,7 @@ static int __pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
         if (likely(values[0])) kw_args--;
@@ -15861,19 +15120,7 @@ static int __pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-      if (values[4]) {
-      } else {
-
-        /* "csamtools.pyx":1481
- *     """
- * 
- *     def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ):             # <<<<<<<<<<<<<<
- * 
- *         if not samfile._isOpen():
- */
-        __pyx_v_reopen = ((int)1);
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -15905,31 +15152,6 @@ static int __pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self), __pyx_v_samfile, __pyx_v_tid, __pyx_v_beg, __pyx_v_end, __pyx_v_reopen);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_beg, int __pyx_v_end, int __pyx_v_reopen) {
-  PyObject *__pyx_v_mode = NULL;
-  PyObject *__pyx_v_store = NULL;
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  char *__pyx_t_5;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1481);
 
   /* "csamtools.pyx":1483
  *     def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ):
@@ -15960,9 +15182,9 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1486
  *             raise ValueError( "I/O operation on closed file" )
@@ -15993,9 +15215,9 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L7;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
   /* "csamtools.pyx":1491
  *         # makes sure that samfile stays alive as long as the
@@ -16006,9 +15228,9 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  */
   __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
-  __Pyx_GOTREF(__pyx_v_self->samfile);
-  __Pyx_DECREF(((PyObject *)__pyx_v_self->samfile));
-  __pyx_v_self->samfile = __pyx_v_samfile;
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile));
+  ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile = __pyx_v_samfile;
 
   /* "csamtools.pyx":1493
  *         self.samfile = samfile
@@ -16020,7 +15242,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
   if (__pyx_v_samfile->isbam) {
     __Pyx_INCREF(((PyObject *)__pyx_n_b__rb));
     __pyx_v_mode = __pyx_n_b__rb;
-    goto __pyx_L5;
+    goto __pyx_L8;
   }
   /*else*/ {
 
@@ -16034,7 +15256,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
     __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
     __pyx_v_mode = __pyx_n_b__r;
   }
-  __pyx_L5:;
+  __pyx_L8:;
 
   /* "csamtools.pyx":1498
  *         # reopen the file - note that this makes the iterator
@@ -16068,7 +15290,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  *             assert self.fp != NULL
  */
     __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_mode)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_self->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
+    ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
 
     /* "csamtools.pyx":1501
  *             store = StderrStore()
@@ -16092,7 +15314,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  *         else:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    if (unlikely(!(__pyx_v_self->fp != NULL))) {
+    if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp != NULL))) {
       PyErr_SetNone(PyExc_AssertionError);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -16105,8 +15327,8 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  *         else:
  *             self.fp = self.samfile.samfile
  */
-    __pyx_v_self->owns_samfile = 1;
-    goto __pyx_L6;
+    ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile = 1;
+    goto __pyx_L9;
   }
   /*else*/ {
 
@@ -16117,7 +15339,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  *             self.owns_samfile = False
  * 
  */
-    __pyx_v_self->fp = __pyx_v_self->samfile->samfile;
+    ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->samfile;
 
     /* "csamtools.pyx":1506
  *         else:
@@ -16126,9 +15348,9 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  * 
  *         self.retval = 0
  */
-    __pyx_v_self->owns_samfile = 0;
+    ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile = 0;
   }
-  __pyx_L6:;
+  __pyx_L9:;
 
   /* "csamtools.pyx":1508
  *             self.owns_samfile = False
@@ -16137,7 +15359,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  * 
  *         self.iter = bam_iter_query(self.samfile.index,
  */
-  __pyx_v_self->retval = 0;
+  ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval = 0;
 
   /* "csamtools.pyx":1510
  *         self.retval = 0
@@ -16146,7 +15368,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  *                                    tid,
  *                                    beg,
  */
-  __pyx_v_self->iter = bam_iter_query(__pyx_v_self->samfile->index, __pyx_v_tid, __pyx_v_beg, __pyx_v_end);
+  ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->iter = bam_iter_query(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->index, __pyx_v_tid, __pyx_v_beg, __pyx_v_end);
 
   /* "csamtools.pyx":1514
  *                                    beg,
@@ -16155,7 +15377,7 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
  * 
  *     def __iter__(self):
  */
-  __pyx_v_self->b = bam_init1();
+  ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b = bam_init1();
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -16172,17 +15394,6 @@ static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_3__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_17IteratorRowRegion_2__iter__(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1516
  *         self.b = bam_init1()
  * 
@@ -16191,11 +15402,12 @@ static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_3__iter__(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__iter__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__iter__", 0);
+  __Pyx_RefNannySetupContext("__iter__");
   __Pyx_TraceCall("__iter__", __pyx_f[0], 1516);
 
   /* "csamtools.pyx":1517
@@ -16206,8 +15418,8 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__iter__(struct __pyx_
  *     cdef bam1_t * getCurrent( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self));
-  __pyx_r = ((PyObject *)__pyx_v_self);
+  __Pyx_INCREF(__pyx_v_self);
+  __pyx_r = __pyx_v_self;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -16230,7 +15442,7 @@ static bam1_t *__pyx_f_9csamtools_17IteratorRowRegion_getCurrent(struct __pyx_ob
   bam1_t *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getCurrent", 0);
+  __Pyx_RefNannySetupContext("getCurrent");
   __Pyx_TraceCall("getCurrent", __pyx_f[0], 1519);
 
   /* "csamtools.pyx":1520
@@ -16262,7 +15474,7 @@ static int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamto
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1522);
 
   /* "csamtools.pyx":1524
@@ -16280,19 +15492,6 @@ static int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamto
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_17IteratorRowRegion_4__next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_17IteratorRowRegion_4__next__;
-static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_5__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_17IteratorRowRegion_4__next__(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1528
  *                                      self.b)
  * 
@@ -16301,7 +15500,10 @@ static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_5__next__(PyObject *__p
  *         """
  */
 
-static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_17IteratorRowRegion_2__next__[] = "python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__;
+static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -16310,7 +15512,7 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__", 0);
+  __Pyx_RefNannySetupContext("__next__");
   __Pyx_TraceCall("__next__", __pyx_f[0], 1528);
 
   /* "csamtools.pyx":1531
@@ -16320,7 +15522,7 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_
  *         if self.retval < 0: raise StopIteration
  *         return makeAlignedRead( self.b )
  */
-  ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)__pyx_v_self->__pyx_vtab)->cnext(__pyx_v_self);
+  ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
 
   /* "csamtools.pyx":1532
  *         """
@@ -16329,13 +15531,13 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_
  *         return makeAlignedRead( self.b )
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->retval < 0);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval < 0);
   if (__pyx_t_1) {
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1533
  *         self.cnext()
@@ -16345,7 +15547,7 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_
  *     def __dealloc__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -16364,15 +15566,6 @@ static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_9csamtools_17IteratorRowRegion_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_9csamtools_17IteratorRowRegion_7__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
 /* "csamtools.pyx":1535
  *         return makeAlignedRead( self.b )
  * 
@@ -16381,10 +15574,11 @@ static void __pyx_pw_9csamtools_17IteratorRowRegion_7__dealloc__(PyObject *__pyx
  *         bam_iter_destroy( self.iter )
  */
 
-static void __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
+static void __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__", 0);
+  __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1535);
 
   /* "csamtools.pyx":1536
@@ -16394,7 +15588,7 @@ static void __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_ob
  *         bam_iter_destroy( self.iter )
  *         if self.owns_samfile: samclose( self.fp )
  */
-  bam_destroy1(__pyx_v_self->b);
+  bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b);
 
   /* "csamtools.pyx":1537
  *     def __dealloc__(self):
@@ -16403,7 +15597,7 @@ static void __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_ob
  *         if self.owns_samfile: samclose( self.fp )
  * 
  */
-  bam_iter_destroy(__pyx_v_self->iter);
+  bam_iter_destroy(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->iter);
 
   /* "csamtools.pyx":1538
  *         bam_destroy1(self.b)
@@ -16412,38 +15606,56 @@ static void __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_ob
  * 
  * cdef class IteratorRowAll(IteratorRow):
  */
-  if (__pyx_v_self->owns_samfile) {
-    samclose(__pyx_v_self->fp);
-    goto __pyx_L3;
+  if (((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile) {
+    samclose(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp);
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1550
+ *     """
+ * 
+ *     def __cinit__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
+ * 
+ *         if not samfile._isOpen():
+ */
+
+static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
   int __pyx_v_reopen;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
+  PyObject *__pyx_v_mode = NULL;
+  PyObject *__pyx_v_store = NULL;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  char *__pyx_t_5;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__cinit__");
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1550);
   {
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
         if (likely(values[0])) kw_args--;
@@ -16455,19 +15667,7 @@ static int __pyx_pw_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_sel
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-      if (values[1]) {
-      } else {
-
-        /* "csamtools.pyx":1550
- *     """
- * 
- *     def __cinit__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
- * 
- *         if not samfile._isOpen():
- */
-        __pyx_v_reopen = ((int)1);
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -16493,31 +15693,6 @@ static int __pyx_pw_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_sel
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_14IteratorRowAll___cinit__(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self), __pyx_v_samfile, __pyx_v_reopen);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen) {
-  PyObject *__pyx_v_mode = NULL;
-  PyObject *__pyx_v_store = NULL;
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  char *__pyx_t_5;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1550);
 
   /* "csamtools.pyx":1552
  *     def __cinit__(self, Samfile samfile, int reopen = True ):
@@ -16548,9 +15723,9 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1555
  *             raise ValueError( "I/O operation on closed file" )
@@ -16562,7 +15737,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
   if (__pyx_v_samfile->isbam) {
     __Pyx_INCREF(((PyObject *)__pyx_n_b__rb));
     __pyx_v_mode = __pyx_n_b__rb;
-    goto __pyx_L4;
+    goto __pyx_L7;
   }
   /*else*/ {
 
@@ -16576,7 +15751,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
     __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
     __pyx_v_mode = __pyx_n_b__r;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
   /* "csamtools.pyx":1559
  * 
@@ -16610,7 +15785,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
  *             assert self.fp != NULL
  */
     __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_mode)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_self->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
+    ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
 
     /* "csamtools.pyx":1562
  *             store = StderrStore()
@@ -16634,7 +15809,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
  *         else:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    if (unlikely(!(__pyx_v_self->fp != NULL))) {
+    if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp != NULL))) {
       PyErr_SetNone(PyExc_AssertionError);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -16647,8 +15822,8 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
  *         else:
  *             self.fp = samfile.samfile
  */
-    __pyx_v_self->owns_samfile = 1;
-    goto __pyx_L5;
+    ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile = 1;
+    goto __pyx_L8;
   }
   /*else*/ {
 
@@ -16659,7 +15834,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
  *             self.owns_samfile = False
  * 
  */
-    __pyx_v_self->fp = __pyx_v_samfile->samfile;
+    ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
     /* "csamtools.pyx":1567
  *         else:
@@ -16668,9 +15843,9 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
  * 
  *         # allocate memory for alignment
  */
-    __pyx_v_self->owns_samfile = 0;
+    ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile = 0;
   }
-  __pyx_L5:;
+  __pyx_L8:;
 
   /* "csamtools.pyx":1570
  * 
@@ -16679,7 +15854,7 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
  * 
  *     def __iter__(self):
  */
-  __pyx_v_self->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
+  ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -16696,17 +15871,6 @@ static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csam
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_3__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_14IteratorRowAll_2__iter__(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1572
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
  * 
@@ -16715,11 +15879,12 @@ static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_3__iter__(PyObject *__pyx_
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__iter__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__iter__", 0);
+  __Pyx_RefNannySetupContext("__iter__");
   __Pyx_TraceCall("__iter__", __pyx_f[0], 1572);
 
   /* "csamtools.pyx":1573
@@ -16730,8 +15895,8 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__iter__(struct __pyx_obj
  *     cdef bam1_t * getCurrent( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self));
-  __pyx_r = ((PyObject *)__pyx_v_self);
+  __Pyx_INCREF(__pyx_v_self);
+  __pyx_r = __pyx_v_self;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -16754,7 +15919,7 @@ static bam1_t *__pyx_f_9csamtools_14IteratorRowAll_getCurrent(struct __pyx_obj_9
   bam1_t *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getCurrent", 0);
+  __Pyx_RefNannySetupContext("getCurrent");
   __Pyx_TraceCall("getCurrent", __pyx_f[0], 1575);
 
   /* "csamtools.pyx":1576
@@ -16786,7 +15951,7 @@ static int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtools
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1578);
 
   /* "csamtools.pyx":1580
@@ -16806,19 +15971,6 @@ static int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtools
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_14IteratorRowAll_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_14IteratorRowAll_4__next__;
-static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_5__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_14IteratorRowAll_4__next__(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1582
  *         return samread(self.fp, self.b)
  * 
@@ -16827,7 +15979,10 @@ static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_5__next__(PyObject *__pyx_
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_14IteratorRowAll_2__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__;
+static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__next__(PyObject *__pyx_v_self) {
   int __pyx_v_ret;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -16837,7 +15992,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__", 0);
+  __Pyx_RefNannySetupContext("__next__");
   __Pyx_TraceCall("__next__", __pyx_f[0], 1582);
 
   /* "csamtools.pyx":1588
@@ -16847,7 +16002,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )
  */
-  __pyx_v_ret = samread(__pyx_v_self->fp, __pyx_v_self->b);
+  __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp, ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b);
 
   /* "csamtools.pyx":1589
  *         cdef int ret
@@ -16867,12 +16022,12 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -16886,7 +16041,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -16901,15 +16056,6 @@ static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_9csamtools_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_9csamtools_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_9csamtools_14IteratorRowAll_6__dealloc__(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
 /* "csamtools.pyx":1594
  *             raise StopIteration
  * 
@@ -16918,10 +16064,11 @@ static void __pyx_pw_9csamtools_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_
  *         if self.owns_samfile: samclose( self.fp )
  */
 
-static void __pyx_pf_9csamtools_14IteratorRowAll_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
+static void __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__", 0);
+  __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1594);
 
   /* "csamtools.pyx":1595
@@ -16931,7 +16078,7 @@ static void __pyx_pf_9csamtools_14IteratorRowAll_6__dealloc__(struct __pyx_obj_9
  *         if self.owns_samfile: samclose( self.fp )
  * 
  */
-  bam_destroy1(__pyx_v_self->b);
+  bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b);
 
   /* "csamtools.pyx":1596
  *     def __dealloc__(self):
@@ -16940,43 +16087,58 @@ static void __pyx_pf_9csamtools_14IteratorRowAll_6__dealloc__(struct __pyx_obj_9
  * 
  * cdef class IteratorRowAllRefs(IteratorRow):
  */
-  if (__pyx_v_self->owns_samfile) {
-    samclose(__pyx_v_self->fp);
-    goto __pyx_L3;
+  if (((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile) {
+    samclose(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp);
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_18IteratorRowAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_18IteratorRowAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1602
+ *     """
+ * 
+ *     def __cinit__(self, Samfile samfile):             # <<<<<<<<<<<<<<
+ *         assert samfile._isOpen()
+ *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
+ */
+
+static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__cinit__");
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1602);
   {
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
         if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
       goto __pyx_L5_argtuple_error;
@@ -16994,36 +16156,6 @@ static int __pyx_pw_9csamtools_18IteratorRowAllRefs_1__cinit__(PyObject *__pyx_v
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self), __pyx_v_samfile);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":1602
- *     """
- * 
- *     def __cinit__(self, Samfile samfile):             # <<<<<<<<<<<<<<
- *         assert samfile._isOpen()
- *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
- */
-
-static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1602);
 
   /* "csamtools.pyx":1603
  * 
@@ -17067,9 +16199,9 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_9
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1605
  *         assert samfile._isOpen()
@@ -17080,9 +16212,9 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_9
  */
   __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
-  __Pyx_GOTREF(__pyx_v_self->samfile);
-  __Pyx_DECREF(((PyObject *)__pyx_v_self->samfile));
-  __pyx_v_self->samfile = __pyx_v_samfile;
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
+  ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile = __pyx_v_samfile;
 
   /* "csamtools.pyx":1606
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
@@ -17091,7 +16223,7 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_9
  * 
  *     def nextiter(self):
  */
-  __pyx_v_self->tid = -1;
+  ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = -1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -17106,18 +16238,6 @@ static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_9
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_3nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_18IteratorRowAllRefs_2nextiter[] = "IteratorRowAllRefs.nextiter(self)";
-static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_3nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("nextiter (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1608
  *         self.tid = -1
  * 
@@ -17126,7 +16246,9 @@ static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_3nextiter(PyObject *__
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_18IteratorRowAllRefs_1nextiter[] = "IteratorRowAllRefs.nextiter(self)";
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -17135,7 +16257,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("nextiter", 0);
+  __Pyx_RefNannySetupContext("nextiter");
   __Pyx_TraceCall("nextiter", __pyx_f[0], 1608);
 
   /* "csamtools.pyx":1609
@@ -17145,13 +16267,13 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx
  * 
  *     def __iter__(self):
  */
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
-  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->samfile));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
+  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
+  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_int_0);
@@ -17165,9 +16287,9 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_GIVEREF(__pyx_t_1);
-  __Pyx_GOTREF(__pyx_v_self->rowiter);
-  __Pyx_DECREF(((PyObject *)__pyx_v_self->rowiter));
-  __pyx_v_self->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_1);
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter));
+  ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_1);
   __pyx_t_1 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -17184,17 +16306,6 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_5__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_5__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_18IteratorRowAllRefs_4__iter__(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1611
  *         self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)
  * 
@@ -17203,11 +16314,12 @@ static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_5__iter__(PyObject *__
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_4__iter__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__iter__", 0);
+  __Pyx_RefNannySetupContext("__iter__");
   __Pyx_TraceCall("__iter__", __pyx_f[0], 1611);
 
   /* "csamtools.pyx":1612
@@ -17218,8 +16330,8 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_4__iter__(struct __pyx
  *     def __next__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self));
-  __pyx_r = ((PyObject *)__pyx_v_self);
+  __Pyx_INCREF(__pyx_v_self);
+  __pyx_r = __pyx_v_self;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -17230,19 +16342,6 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_4__iter__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_18IteratorRowAllRefs_6__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_6__next__;
-static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1614
  *         return self
  * 
@@ -17251,7 +16350,10 @@ static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__(PyObject *__
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__;
+static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -17263,7 +16365,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__", 0);
+  __Pyx_RefNannySetupContext("__next__");
   __Pyx_TraceCall("__next__", __pyx_f[0], 1614);
 
   /* "csamtools.pyx":1620
@@ -17273,7 +16375,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  *             if not self.samfile.nreferences:
  *                 raise StopIteration
  */
-  __pyx_t_1 = (__pyx_v_self->tid == -1);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid == -1);
   if (__pyx_t_1) {
 
     /* "csamtools.pyx":1621
@@ -17283,7 +16385,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  *                 raise StopIteration
  *             self.tid = 0
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -17299,9 +16401,9 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  */
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L4;
+      goto __pyx_L6;
     }
-    __pyx_L4:;
+    __pyx_L6:;
 
     /* "csamtools.pyx":1623
  *             if not self.samfile.nreferences:
@@ -17310,7 +16412,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  *             self.nextiter()
  * 
  */
-    __pyx_v_self->tid = 0;
+    ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = 0;
 
     /* "csamtools.pyx":1624
  *                 raise StopIteration
@@ -17319,15 +16421,15 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  * 
  *         while 1:
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__nextiter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1626
  *             self.nextiter()
@@ -17346,7 +16448,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  * 
  *             # If current iterator is not exhausted, return aligned read
  */
-    ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)__pyx_v_self->rowiter->__pyx_vtab)->cnext(__pyx_v_self->rowiter);
+    ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter);
 
     /* "csamtools.pyx":1630
  * 
@@ -17355,7 +16457,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  *                 return makeAlignedRead(self.rowiter.b)
  * 
  */
-    __pyx_t_3 = (__pyx_v_self->rowiter->retval > 0);
+    __pyx_t_3 = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->retval > 0);
     if (__pyx_t_3) {
 
       /* "csamtools.pyx":1631
@@ -17366,14 +16468,14 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  *             self.tid += 1
  */
       __Pyx_XDECREF(__pyx_r);
-      __pyx_t_4 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->rowiter->b); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->b); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __pyx_r = __pyx_t_4;
       __pyx_t_4 = 0;
       goto __pyx_L0;
-      goto __pyx_L7;
+      goto __pyx_L9;
     }
-    __pyx_L7:;
+    __pyx_L9:;
 
     /* "csamtools.pyx":1633
  *                 return makeAlignedRead(self.rowiter.b)
@@ -17382,7 +16484,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  * 
  *             # Otherwise, proceed to next reference or stop
  */
-    __pyx_v_self->tid = (__pyx_v_self->tid + 1);
+    ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid + 1);
 
     /* "csamtools.pyx":1636
  * 
@@ -17391,9 +16493,9 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  *                 self.nextiter()
  *             else:
  */
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
@@ -17410,13 +16512,13 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
  *             else:
  *                 raise StopIteration
  */
-      __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__nextiter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      goto __pyx_L8;
+      goto __pyx_L10;
     }
     /*else*/ {
 
@@ -17430,7 +16532,7 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
-    __pyx_L8:;
+    __pyx_L10:;
   }
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -17448,22 +16550,40 @@ static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1647
+ *     """
+ * 
+ *     def __cinit__(self, Samfile samfile, positions, int reopen = True ):             # <<<<<<<<<<<<<<
+ * 
+ *         if not samfile._isOpen():
+ */
+
+static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
   PyObject *__pyx_v_positions = 0;
   int __pyx_v_reopen;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__positions,&__pyx_n_s__reopen,0};
+  PyObject *__pyx_v_mode = NULL;
+  PyObject *__pyx_v_store = NULL;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  char *__pyx_t_5;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__positions,&__pyx_n_s__reopen,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__cinit__");
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1647);
   {
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
@@ -17471,7 +16591,7 @@ static int __pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
         if (likely(values[0])) kw_args--;
@@ -17489,19 +16609,7 @@ static int __pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-      if (values[2]) {
-      } else {
-
-        /* "csamtools.pyx":1647
- *     """
- * 
- *     def __cinit__(self, Samfile samfile, positions, int reopen = True ):             # <<<<<<<<<<<<<<
- * 
- *         if not samfile._isOpen():
- */
-        __pyx_v_reopen = ((int)1);
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -17529,31 +16637,6 @@ static int __pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self), __pyx_v_samfile, __pyx_v_positions, __pyx_v_reopen);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_positions, int __pyx_v_reopen) {
-  PyObject *__pyx_v_mode = NULL;
-  PyObject *__pyx_v_store = NULL;
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_t_4;
-  char *__pyx_t_5;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1647);
 
   /* "csamtools.pyx":1649
  *     def __cinit__(self, Samfile samfile, positions, int reopen = True ):
@@ -17584,9 +16667,9 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1652
  *             raise ValueError( "I/O operation on closed file" )
@@ -17617,9 +16700,9 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L7;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
   /* "csamtools.pyx":1655
  *             raise ValueError( "I/O operation on closed file" )
@@ -17677,7 +16760,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
  *             assert self.fp != NULL
  */
     __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_mode)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_self->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
+    ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
 
     /* "csamtools.pyx":1662
  *             store = StderrStore()
@@ -17701,7 +16784,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
  *         else:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    if (unlikely(!(__pyx_v_self->fp != NULL))) {
+    if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp != NULL))) {
       PyErr_SetNone(PyExc_AssertionError);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -17714,8 +16797,8 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
  *         else:
  *             self.fp = samfile.samfile
  */
-    __pyx_v_self->owns_samfile = 1;
-    goto __pyx_L5;
+    ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile = 1;
+    goto __pyx_L8;
   }
   /*else*/ {
 
@@ -17726,7 +16809,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
  *             self.owns_samfile = False
  * 
  */
-    __pyx_v_self->fp = __pyx_v_samfile->samfile;
+    ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
     /* "csamtools.pyx":1667
  *         else:
@@ -17735,9 +16818,9 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
  * 
  *         # allocate memory for alignment
  */
-    __pyx_v_self->owns_samfile = 0;
+    ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile = 0;
   }
-  __pyx_L5:;
+  __pyx_L8:;
 
   /* "csamtools.pyx":1670
  * 
@@ -17746,7 +16829,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
  * 
  *         self.positions = positions
  */
-  __pyx_v_self->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
+  ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
 
   /* "csamtools.pyx":1672
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
@@ -17757,9 +16840,9 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
  */
   __Pyx_INCREF(__pyx_v_positions);
   __Pyx_GIVEREF(__pyx_v_positions);
-  __Pyx_GOTREF(__pyx_v_self->positions);
-  __Pyx_DECREF(__pyx_v_self->positions);
-  __pyx_v_self->positions = __pyx_v_positions;
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions);
+  __Pyx_DECREF(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions);
+  ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions = __pyx_v_positions;
 
   /* "csamtools.pyx":1673
  * 
@@ -17768,7 +16851,7 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
  * 
  *     def __iter__(self):
  */
-  __pyx_v_self->current_pos = 0;
+  ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->current_pos = 0;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -17785,17 +16868,6 @@ static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_3__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_20IteratorRowSelection_2__iter__(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1675
  *         self.current_pos = 0
  * 
@@ -17804,11 +16876,12 @@ static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_3__iter__(PyObject *
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__iter__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__iter__", 0);
+  __Pyx_RefNannySetupContext("__iter__");
   __Pyx_TraceCall("__iter__", __pyx_f[0], 1675);
 
   /* "csamtools.pyx":1676
@@ -17819,8 +16892,8 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__iter__(struct __p
  *     cdef bam1_t * getCurrent( self ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self));
-  __pyx_r = ((PyObject *)__pyx_v_self);
+  __Pyx_INCREF(__pyx_v_self);
+  __pyx_r = __pyx_v_self;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -17843,7 +16916,7 @@ static bam1_t *__pyx_f_9csamtools_20IteratorRowSelection_getCurrent(struct __pyx
   bam1_t *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getCurrent", 0);
+  __Pyx_RefNannySetupContext("getCurrent");
   __Pyx_TraceCall("getCurrent", __pyx_f[0], 1678);
 
   /* "csamtools.pyx":1679
@@ -17882,7 +16955,7 @@ static int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1681);
 
   /* "csamtools.pyx":1685
@@ -17948,19 +17021,6 @@ static int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_20IteratorRowSelection_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorRowSelection_4__next__;
-static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_5__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_20IteratorRowSelection_4__next__(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1691
  *         return samread(self.fp, self.b)
  * 
@@ -17969,7 +17029,10 @@ static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_5__next__(PyObject *
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_20IteratorRowSelection_2__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__;
+static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__next__(PyObject *__pyx_v_self) {
   int __pyx_v_ret;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -17979,7 +17042,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __p
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__", 0);
+  __Pyx_RefNannySetupContext("__next__");
   __Pyx_TraceCall("__next__", __pyx_f[0], 1691);
 
   /* "csamtools.pyx":1697
@@ -17989,7 +17052,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __p
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )
  */
-  __pyx_v_ret = ((struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *)__pyx_v_self->__pyx_vtab)->cnext(__pyx_v_self);
+  __pyx_v_ret = ((struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *)((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
 
   /* "csamtools.pyx":1698
  * 
@@ -18009,12 +17072,12 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __p
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -18028,7 +17091,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __p
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -18043,15 +17106,6 @@ static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_9csamtools_20IteratorRowSelection_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_9csamtools_20IteratorRowSelection_7__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_9csamtools_20IteratorRowSelection_6__dealloc__(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
 /* "csamtools.pyx":1703
  *             raise StopIteration
  * 
@@ -18060,10 +17114,11 @@ static void __pyx_pw_9csamtools_20IteratorRowSelection_7__dealloc__(PyObject *__
  *         if self.owns_samfile: samclose( self.fp )
  */
 
-static void __pyx_pf_9csamtools_20IteratorRowSelection_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
+static void __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__", 0);
+  __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1703);
 
   /* "csamtools.pyx":1704
@@ -18073,7 +17128,7 @@ static void __pyx_pf_9csamtools_20IteratorRowSelection_6__dealloc__(struct __pyx
  *         if self.owns_samfile: samclose( self.fp )
  * 
  */
-  bam_destroy1(__pyx_v_self->b);
+  bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b);
 
   /* "csamtools.pyx":1705
  *     def __dealloc__(self):
@@ -18082,11 +17137,11 @@ static void __pyx_pf_9csamtools_20IteratorRowSelection_6__dealloc__(struct __pyx
  * 
  * ##-------------------------------------------------------------------
  */
-  if (__pyx_v_self->owns_samfile) {
-    samclose(__pyx_v_self->fp);
-    goto __pyx_L3;
+  if (((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile) {
+    samclose(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp);
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
@@ -18105,7 +17160,7 @@ static int __pyx_f_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v_
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__advance_all", 0);
+  __Pyx_RefNannySetupContext("__advance_all");
   __Pyx_TraceCall("__advance_all", __pyx_f[0], 1710);
 
   /* "csamtools.pyx":1714
@@ -18163,7 +17218,7 @@ static int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__p
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__advance_snpcalls", 0);
+  __Pyx_RefNannySetupContext("__advance_snpcalls");
   __Pyx_TraceCall("__advance_snpcalls", __pyx_f[0], 1717);
 
   /* "csamtools.pyx":1722
@@ -18298,7 +17353,7 @@ static int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__p
       __pyx_t_5 = PyInt_FromLong(__pyx_v_d->tid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
       PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
@@ -18309,7 +17364,7 @@ static int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__p
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
       __pyx_t_5 = 0;
@@ -18507,36 +17562,50 @@ static int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_14IteratorColumn_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_14IteratorColumn_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1813
+ *     '''
+ * 
+ *     def __cinit__( self, Samfile samfile, **kwargs ):             # <<<<<<<<<<<<<<
+ *         self.samfile = samfile
+ *         self.mask = kwargs.get("mask", BAM_DEF_MASK )
+ */
+
+static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
   PyObject *__pyx_v_kwargs = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__cinit__");
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1813);
   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
   __Pyx_GOTREF(__pyx_v_kwargs);
   {
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
         if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
       goto __pyx_L5_argtuple_error;
@@ -18555,36 +17624,6 @@ static int __pyx_pw_9csamtools_14IteratorColumn_1__cinit__(PyObject *__pyx_v_sel
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_14IteratorColumn___cinit__(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_samfile, __pyx_v_kwargs);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_XDECREF(__pyx_v_kwargs);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":1813
- *     '''
- * 
- *     def __cinit__( self, Samfile samfile, **kwargs ):             # <<<<<<<<<<<<<<
- *         self.samfile = samfile
- *         self.mask = kwargs.get("mask", BAM_DEF_MASK )
- */
-
-static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_kwargs) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1813);
 
   /* "csamtools.pyx":1814
  * 
@@ -18595,9 +17634,9 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  */
   __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
-  __Pyx_GOTREF(__pyx_v_self->samfile);
-  __Pyx_DECREF(((PyObject *)__pyx_v_self->samfile));
-  __pyx_v_self->samfile = __pyx_v_samfile;
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile));
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile = __pyx_v_samfile;
 
   /* "csamtools.pyx":1815
  *     def __cinit__( self, Samfile samfile, **kwargs ):
@@ -18606,6 +17645,9 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.fastafile = kwargs.get( "fastafile", None )
  *         self.stepper = kwargs.get( "stepper", None )
  */
+  if (unlikely(((PyObject *)__pyx_v_kwargs) == Py_None)) {
+    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
   __pyx_t_1 = PyInt_FromLong(BAM_DEF_MASK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__mask), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -18613,7 +17655,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_v_self->mask = __pyx_t_3;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->mask = __pyx_t_3;
 
   /* "csamtools.pyx":1816
  *         self.samfile = samfile
@@ -18622,13 +17664,16 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.stepper = kwargs.get( "stepper", None )
  *         self.max_depth = kwargs.get( "max_depth", 8000 )
  */
+  if (unlikely(((PyObject *)__pyx_v_kwargs) == Py_None)) {
+    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
   __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__fastafile), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_Fastafile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GIVEREF(__pyx_t_2);
-  __Pyx_GOTREF(__pyx_v_self->fastafile);
-  __Pyx_DECREF(((PyObject *)__pyx_v_self->fastafile));
-  __pyx_v_self->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_t_2);
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile));
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_t_2);
   __pyx_t_2 = 0;
 
   /* "csamtools.pyx":1817
@@ -18638,12 +17683,15 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.max_depth = kwargs.get( "max_depth", 8000 )
  *         self.iterdata.seq = NULL
  */
+  if (unlikely(((PyObject *)__pyx_v_kwargs) == Py_None)) {
+    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
   __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__stepper), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
-  __Pyx_GOTREF(__pyx_v_self->stepper);
-  __Pyx_DECREF(__pyx_v_self->stepper);
-  __pyx_v_self->stepper = __pyx_t_2;
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper);
+  __Pyx_DECREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper);
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper = __pyx_t_2;
   __pyx_t_2 = 0;
 
   /* "csamtools.pyx":1818
@@ -18653,11 +17701,14 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.iterdata.seq = NULL
  *         self.tid = 0
  */
+  if (unlikely(((PyObject *)__pyx_v_kwargs) == Py_None)) {
+    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
   __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_depth), __pyx_int_8000); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_v_self->max_depth = __pyx_t_3;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->max_depth = __pyx_t_3;
 
   /* "csamtools.pyx":1819
  *         self.stepper = kwargs.get( "stepper", None )
@@ -18666,7 +17717,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.tid = 0
  *         self.pos = 0
  */
-  __pyx_v_self->iterdata.seq = NULL;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq = NULL;
 
   /* "csamtools.pyx":1820
  *         self.max_depth = kwargs.get( "max_depth", 8000 )
@@ -18675,7 +17726,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.pos = 0
  *         self.n_plp = 0
  */
-  __pyx_v_self->tid = 0;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->tid = 0;
 
   /* "csamtools.pyx":1821
  *         self.iterdata.seq = NULL
@@ -18684,7 +17735,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.n_plp = 0
  *         self.plp = NULL
  */
-  __pyx_v_self->pos = 0;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pos = 0;
 
   /* "csamtools.pyx":1822
  *         self.tid = 0
@@ -18693,7 +17744,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.plp = NULL
  *         self.pileup_iter = <bam_plp_t>NULL
  */
-  __pyx_v_self->n_plp = 0;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->n_plp = 0;
 
   /* "csamtools.pyx":1823
  *         self.pos = 0
@@ -18702,7 +17753,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  *         self.pileup_iter = <bam_plp_t>NULL
  * 
  */
-  __pyx_v_self->plp = NULL;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->plp = NULL;
 
   /* "csamtools.pyx":1824
  *         self.n_plp = 0
@@ -18711,7 +17762,7 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
  * 
  * 
  */
-  __pyx_v_self->pileup_iter = NULL;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter = ((bam_plp_t)NULL);
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -18721,22 +17772,12 @@ static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csam
   __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_kwargs);
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_14IteratorColumn_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_14IteratorColumn_3__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_14IteratorColumn_2__iter__(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1827
  * 
  * 
@@ -18745,11 +17786,12 @@ static PyObject *__pyx_pw_9csamtools_14IteratorColumn_3__iter__(PyObject *__pyx_
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2__iter__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_1__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_1__iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__iter__", 0);
+  __Pyx_RefNannySetupContext("__iter__");
   __Pyx_TraceCall("__iter__", __pyx_f[0], 1827);
 
   /* "csamtools.pyx":1828
@@ -18760,8 +17802,8 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2__iter__(struct __pyx_obj
  *     cdef int cnext(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self));
-  __pyx_r = ((PyObject *)__pyx_v_self);
+  __Pyx_INCREF(__pyx_v_self);
+  __pyx_r = __pyx_v_self;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -18784,7 +17826,7 @@ static int __pyx_f_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_9csamtools
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1830);
 
   /* "csamtools.pyx":1836
@@ -18814,7 +17856,7 @@ static char *__pyx_f_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_9c
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getSequence", 0);
+  __Pyx_RefNannySetupContext("getSequence");
   __Pyx_TraceCall("getSequence", __pyx_f[0], 1841);
 
   /* "csamtools.pyx":1844
@@ -18834,17 +17876,6 @@ static char *__pyx_f_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7seq_len_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7seq_len_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1848
  *     property seq_len:
  *         '''current sequence length.'''
@@ -18853,7 +17884,8 @@ static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7seq_len_1__get__(PyObject
  *     def addReference( self, Fastafile fastafile ):
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -18861,10 +17893,10 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(struct __
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 1848);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->iterdata.seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -18883,23 +17915,6 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_14IteratorColumn_5addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile); /*proto*/
-static char __pyx_doc_9csamtools_14IteratorColumn_4addReference[] = "IteratorColumn.addReference(self, Fastafile fastafile)\n\n       add reference sequences in *fastafile* to iterator.";
-static PyObject *__pyx_pw_9csamtools_14IteratorColumn_5addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("addReference (wrapper)", 0);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fastafile), __pyx_ptype_9csamtools_Fastafile, 1, "fastafile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_14IteratorColumn_4addReference(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_fastafile));
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1850
  *         def __get__(self): return self.iterdata.seq_len
  * 
@@ -18908,13 +17923,19 @@ static PyObject *__pyx_pw_9csamtools_14IteratorColumn_5addReference(PyObject *__
  *        add reference sequences in *fastafile* to iterator.'''
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_4addReference(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_9csamtools_Fastafile *__pyx_v_fastafile) {
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile); /*proto*/
+static char __pyx_doc_9csamtools_14IteratorColumn_2addReference[] = "IteratorColumn.addReference(self, Fastafile fastafile)\n\n       add reference sequences in *fastafile* to iterator.";
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("addReference", 0);
+  __Pyx_RefNannySetupContext("addReference");
   __Pyx_TraceCall("addReference", __pyx_f[0], 1850);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fastafile), __pyx_ptype_9csamtools_Fastafile, 1, "fastafile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":1853
  *        '''
@@ -18923,11 +17944,11 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_4addReference(struct __pyx
  *        if self.iterdata.seq != NULL: free(self.iterdata.seq)
  *        self.iterdata.tid = -1
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_fastafile));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_fastafile));
-  __Pyx_GOTREF(__pyx_v_self->fastafile);
-  __Pyx_DECREF(((PyObject *)__pyx_v_self->fastafile));
-  __pyx_v_self->fastafile = __pyx_v_fastafile;
+  __Pyx_INCREF(__pyx_v_fastafile);
+  __Pyx_GIVEREF(__pyx_v_fastafile);
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile));
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_fastafile);
 
   /* "csamtools.pyx":1854
  *        add reference sequences in *fastafile* to iterator.'''
@@ -18936,12 +17957,12 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_4addReference(struct __pyx
  *        self.iterdata.tid = -1
  *        self.iterdata.fastafile = self.fastafile.fastafile
  */
-  __pyx_t_1 = (__pyx_v_self->iterdata.seq != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq != NULL);
   if (__pyx_t_1) {
-    free(__pyx_v_self->iterdata.seq);
-    goto __pyx_L3;
+    free(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq);
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1855
  *        self.fastafile = fastafile
@@ -18950,7 +17971,7 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_4addReference(struct __pyx
  *        self.iterdata.fastafile = self.fastafile.fastafile
  * 
  */
-  __pyx_v_self->iterdata.tid = -1;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.tid = -1;
 
   /* "csamtools.pyx":1856
  *        if self.iterdata.seq != NULL: free(self.iterdata.seq)
@@ -18959,27 +17980,20 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_4addReference(struct __pyx
  * 
  *     def hasReference( self ):
  */
-  __pyx_v_self->iterdata.fastafile = __pyx_v_self->fastafile->fastafile;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.fastafile = ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile->fastafile;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_AddTraceback("csamtools.IteratorColumn.addReference", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_TraceReturn(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_14IteratorColumn_6hasReference[] = "IteratorColumn.hasReference(self)\n\n        return true if iterator is associated with a reference";
-static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("hasReference (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_14IteratorColumn_6hasReference(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1858
  *        self.iterdata.fastafile = self.fastafile.fastafile
  * 
@@ -18988,11 +18002,13 @@ static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7hasReference(PyObject *__
  *         return true if iterator is associated with a reference'''
  */
 
-static PyObject *__pyx_pf_9csamtools_14IteratorColumn_6hasReference(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_3hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_14IteratorColumn_3hasReference[] = "IteratorColumn.hasReference(self)\n\n        return true if iterator is associated with a reference";
+static PyObject *__pyx_pf_9csamtools_14IteratorColumn_3hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("hasReference", 0);
+  __Pyx_RefNannySetupContext("hasReference");
   __Pyx_TraceCall("hasReference", __pyx_f[0], 1858);
 
   /* "csamtools.pyx":1861
@@ -19003,8 +18019,8 @@ static PyObject *__pyx_pf_9csamtools_14IteratorColumn_6hasReference(struct __pyx
  *     cdef setMask( self, mask ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->fastafile));
-  __pyx_r = ((PyObject *)__pyx_v_self->fastafile);
+  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile));
+  __pyx_r = ((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile);
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -19031,7 +18047,7 @@ static PyObject *__pyx_f_9csamtools_14IteratorColumn_setMask(struct __pyx_obj_9c
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("setMask", 0);
+  __Pyx_RefNannySetupContext("setMask");
   __Pyx_TraceCall("setMask", __pyx_f[0], 1863);
 
   /* "csamtools.pyx":1868
@@ -19089,7 +18105,7 @@ static PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct __
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("setupIteratorData", 0);
+  __Pyx_RefNannySetupContext("setupIteratorData");
   __Pyx_TraceCall("setupIteratorData", __pyx_f[0], 1871);
   if (__pyx_optional_args) {
     if (__pyx_optional_args->__pyx_n > 0) {
@@ -19113,7 +18129,7 @@ static PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct __
   __pyx_t_4 = PyInt_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
   PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
@@ -19272,7 +18288,7 @@ static PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct __
     __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_127), __pyx_v_self->stepper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
     __pyx_t_4 = 0;
@@ -19351,7 +18367,7 @@ static PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("reset", 0);
+  __Pyx_RefNannySetupContext("reset");
   __Pyx_TraceCall("reset", __pyx_f[0], 1901);
 
   /* "csamtools.pyx":1907
@@ -19362,7 +18378,7 @@ static PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9csa
  * 
  */
   __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
   PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
@@ -19378,7 +18394,7 @@ static PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9csa
   __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
@@ -19472,15 +18488,6 @@ static PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_9csamtools_14IteratorColumn_9__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_9csamtools_14IteratorColumn_9__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
 /* "csamtools.pyx":1919
  *         bam_plp_reset(self.pileup_iter)
  * 
@@ -19489,11 +18496,12 @@ static void __pyx_pw_9csamtools_14IteratorColumn_9__dealloc__(PyObject *__pyx_v_
  *         # not been fully consumed
  */
 
-static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
+static void __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__", 0);
+  __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1919);
 
   /* "csamtools.pyx":1922
@@ -19503,7 +18511,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9
  *             bam_plp_reset(self.pileup_iter)
  *             bam_plp_destroy(self.pileup_iter)
  */
-  __pyx_t_1 = (__pyx_v_self->pileup_iter != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter != ((bam_plp_t)NULL));
   if (__pyx_t_1) {
 
     /* "csamtools.pyx":1923
@@ -19513,7 +18521,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9
  *             bam_plp_destroy(self.pileup_iter)
  *             self.pileup_iter = <bam_plp_t>NULL
  */
-    bam_plp_reset(__pyx_v_self->pileup_iter);
+    bam_plp_reset(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter);
 
     /* "csamtools.pyx":1924
  *         if self.pileup_iter != <bam_plp_t>NULL:
@@ -19522,7 +18530,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9
  *             self.pileup_iter = <bam_plp_t>NULL
  * 
  */
-    bam_plp_destroy(__pyx_v_self->pileup_iter);
+    bam_plp_destroy(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter);
 
     /* "csamtools.pyx":1925
  *             bam_plp_reset(self.pileup_iter)
@@ -19531,10 +18539,10 @@ static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9
  * 
  *         if self.iterdata.seq != NULL:
  */
-    __pyx_v_self->pileup_iter = NULL;
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter = ((bam_plp_t)NULL);
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":1927
  *             self.pileup_iter = <bam_plp_t>NULL
@@ -19543,7 +18551,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9
  *             free(self.iterdata.seq)
  *             self.iterdata.seq = NULL
  */
-  __pyx_t_1 = (__pyx_v_self->iterdata.seq != NULL);
+  __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq != NULL);
   if (__pyx_t_1) {
 
     /* "csamtools.pyx":1928
@@ -19553,7 +18561,7 @@ static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9
  *             self.iterdata.seq = NULL
  * 
  */
-    free(__pyx_v_self->iterdata.seq);
+    free(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq);
 
     /* "csamtools.pyx":1929
  *         if self.iterdata.seq != NULL:
@@ -19562,36 +18570,49 @@ static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9
  * 
  * cdef class IteratorColumnRegion(IteratorColumn):
  */
-    __pyx_v_self->iterdata.seq = NULL;
-    goto __pyx_L4;
+    ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq = NULL;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
+/* "csamtools.pyx":1934
+ *     '''iterates over a region only.
+ *     '''
+ *     def __cinit__(self, Samfile samfile,             # <<<<<<<<<<<<<<
+ *                   int tid = 0,
+ *                   int start = 0,
+ */
+
+static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
   int __pyx_v_tid;
   int __pyx_v_start;
   int __pyx_v_end;
   int __pyx_v_truncate;
-  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__truncate,0};
+  PyObject *__pyx_v_kwargs = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_2;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__truncate,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__cinit__");
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1934);
   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
   __Pyx_GOTREF(__pyx_v_kwargs);
   {
     PyObject* values[5] = {0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
@@ -19601,7 +18622,7 @@ static int __pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
         if (likely(values[0])) kw_args--;
@@ -19628,31 +18649,7 @@ static int __pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-      if (values[1]) {
-      } else {
-        __pyx_v_tid = ((int)0);
-      }
-      if (values[2]) {
-      } else {
-        __pyx_v_start = ((int)0);
-      }
-      if (values[3]) {
-      } else {
-        __pyx_v_end = __pyx_k_128;
-      }
-      if (values[4]) {
-      } else {
-
-        /* "csamtools.pyx":1938
- *                   int start = 0,
- *                   int end = max_pos,
- *                   int truncate = False,             # <<<<<<<<<<<<<<
- *                   **kwargs ):
- * 
- */
-        __pyx_v_truncate = ((int)0);
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -19684,6 +18681,14 @@ static int __pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx
     if (values[4]) {
       __pyx_v_truncate = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_truncate == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
+
+      /* "csamtools.pyx":1938
+ *                   int start = 0,
+ *                   int end = max_pos,
+ *                   int truncate = False,             # <<<<<<<<<<<<<<
+ *                   **kwargs ):
+ * 
+ */
       __pyx_v_truncate = ((int)0);
     }
   }
@@ -19697,35 +18702,6 @@ static int __pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self), __pyx_v_samfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end, __pyx_v_truncate, __pyx_v_kwargs);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_XDECREF(__pyx_v_kwargs);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":1934
- *     '''iterates over a region only.
- *     '''
- *     def __cinit__(self, Samfile samfile,             # <<<<<<<<<<<<<<
- *                   int tid = 0,
- *                   int start = 0,
- */
-
-static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj_9csamtools_IteratorColumnRegion *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, int __pyx_v_truncate, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_2;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1934);
 
   /* "csamtools.pyx":1942
  * 
@@ -19736,7 +18712,7 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj
  */
   __pyx_t_2.__pyx_n = 1;
   __pyx_t_2.reopen = 1;
-  __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_tid, __pyx_v_start, __pyx_v_end, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_tid, __pyx_v_start, __pyx_v_end, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
@@ -19747,7 +18723,7 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj
  *         self.end = end
  *         self.truncate = truncate
  */
-  __pyx_v_self->start = __pyx_v_start;
+  ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->start = __pyx_v_start;
 
   /* "csamtools.pyx":1944
  *         self.setupIteratorData( tid, start, end, 1 )
@@ -19756,7 +18732,7 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj
  *         self.truncate = truncate
  * 
  */
-  __pyx_v_self->end = __pyx_v_end;
+  ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->end = __pyx_v_end;
 
   /* "csamtools.pyx":1945
  *         self.start = start
@@ -19765,7 +18741,7 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj
  * 
  *     def __next__(self):
  */
-  __pyx_v_self->truncate = __pyx_v_truncate;
+  ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->truncate = __pyx_v_truncate;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -19774,24 +18750,12 @@ static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj
   __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_kwargs);
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_20IteratorColumnRegion_3__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_20IteratorColumnRegion_2__next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_2__next__;
-static PyObject *__pyx_pw_9csamtools_20IteratorColumnRegion_3__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1947
  *         self.truncate = truncate
  * 
@@ -19800,7 +18764,10 @@ static PyObject *__pyx_pw_9csamtools_20IteratorColumnRegion_3__next__(PyObject *
  *         """
  */
 
-static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __pyx_obj_9csamtools_IteratorColumnRegion *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_20IteratorColumnRegion_1__next__[] = "python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__;
+static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -19809,7 +18776,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__", 0);
+  __Pyx_RefNannySetupContext("__next__");
   __Pyx_TraceCall("__next__", __pyx_f[0], 1947);
 
   /* "csamtools.pyx":1951
@@ -19829,7 +18796,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
  *             if self.n_plp < 0:
  *                 raise ValueError("error during iteration" )
  */
-    ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
+    ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
 
     /* "csamtools.pyx":1953
  *         while 1:
@@ -19838,7 +18805,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
  *                 raise ValueError("error during iteration" )
  * 
  */
-    __pyx_t_1 = (__pyx_v_self->__pyx_base.n_plp < 0);
+    __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp < 0);
     if (__pyx_t_1) {
 
       /* "csamtools.pyx":1954
@@ -19853,9 +18820,9 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
       __Pyx_Raise(__pyx_t_2, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L5;
+      goto __pyx_L7;
     }
-    __pyx_L5:;
+    __pyx_L7:;
 
     /* "csamtools.pyx":1956
  *                 raise ValueError("error during iteration" )
@@ -19864,7 +18831,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
  *                 raise StopIteration
  * 
  */
-    __pyx_t_1 = (__pyx_v_self->__pyx_base.plp == NULL);
+    __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp == NULL);
     if (__pyx_t_1) {
 
       /* "csamtools.pyx":1957
@@ -19876,9 +18843,9 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
  */
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
-    __pyx_L6:;
+    __pyx_L8:;
 
     /* "csamtools.pyx":1959
  *                 raise StopIteration
@@ -19887,7 +18854,7 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
  *                 if self.start < self.pos: continue
  *                 if self.pos >= self.end: raise StopIteration
  */
-    if (__pyx_v_self->truncate) {
+    if (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->truncate) {
 
       /* "csamtools.pyx":1960
  * 
@@ -19896,12 +18863,12 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
  *                 if self.pos >= self.end: raise StopIteration
  * 
  */
-      __pyx_t_1 = (__pyx_v_self->start < __pyx_v_self->__pyx_base.pos);
+      __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->start < ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.pos);
       if (__pyx_t_1) {
-        goto __pyx_L3_continue;
-        goto __pyx_L8;
+        goto __pyx_L5_continue;
+        goto __pyx_L10;
       }
-      __pyx_L8:;
+      __pyx_L10:;
 
       /* "csamtools.pyx":1961
  *             if self.truncate:
@@ -19910,16 +18877,16 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
  * 
  *             return makePileupProxy( &self.plp,
  */
-      __pyx_t_1 = (__pyx_v_self->__pyx_base.pos >= __pyx_v_self->end);
+      __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.pos >= ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->end);
       if (__pyx_t_1) {
         __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L9;
+        goto __pyx_L11;
       }
-      __pyx_L9:;
-      goto __pyx_L7;
+      __pyx_L11:;
+      goto __pyx_L9;
     }
-    __pyx_L7:;
+    __pyx_L9:;
 
     /* "csamtools.pyx":1963
  *                 if self.pos >= self.end: raise StopIteration
@@ -19937,12 +18904,12 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
  * 
  * cdef class IteratorColumnAllRefs(IteratorColumn):
  */
-    __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy((&__pyx_v_self->__pyx_base.plp), __pyx_v_self->__pyx_base.tid, __pyx_v_self->__pyx_base.pos, __pyx_v_self->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy((&((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE [...]
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    __pyx_L3_continue:;
+    __pyx_L5_continue:;
   }
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -19958,36 +18925,51 @@ static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_21IteratorColumnAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_21IteratorColumnAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":1972
+ *     """
+ * 
+ *     def __cinit__(self,             # <<<<<<<<<<<<<<
+ *                   Samfile samfile,
+ *                   **kwargs ):
+ */
+
+static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
-  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
+  PyObject *__pyx_v_kwargs = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
+  struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_4;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__cinit__");
+  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1972);
   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
   __Pyx_GOTREF(__pyx_v_kwargs);
   {
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
         if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
       goto __pyx_L5_argtuple_error;
@@ -20006,37 +18988,6 @@ static int __pyx_pw_9csamtools_21IteratorColumnAllRefs_1__cinit__(PyObject *__py
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self), __pyx_v_samfile, __pyx_v_kwargs);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_XDECREF(__pyx_v_kwargs);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":1972
- *     """
- * 
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   Samfile samfile,
- *                   **kwargs ):
- */
-
-static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_obj_9csamtools_IteratorColumnAllRefs *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
-  int __pyx_t_3;
-  struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_4;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__cinit__", 0);
-  __Pyx_TraceCall("__cinit__", __pyx_f[0], 1972);
 
   /* "csamtools.pyx":1977
  * 
@@ -20053,9 +19004,9 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_ob
   if (__pyx_t_3) {
     __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":1980
  * 
@@ -20066,7 +19017,7 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_ob
  */
   __pyx_t_4.__pyx_n = 1;
   __pyx_t_4.reopen = 1;
-  __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_self->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; g [...]
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
@@ -20077,24 +19028,12 @@ static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_ob
   __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_kwargs);
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_21IteratorColumnAllRefs_2__next__[] = "python version of next().\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_2__next__;
-static PyObject *__pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":1982
  *         self.setupIteratorData( self.tid, 0, max_pos, 1 )
  * 
@@ -20103,7 +19042,10 @@ static PyObject *__pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__(PyObject
  *         """
  */
 
-static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __pyx_obj_9csamtools_IteratorColumnAllRefs *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__[] = "python version of next().\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__;
+static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -20115,7 +19057,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__next__", 0);
+  __Pyx_RefNannySetupContext("__next__");
   __Pyx_TraceCall("__next__", __pyx_f[0], 1982);
 
   /* "csamtools.pyx":1986
@@ -20135,7 +19077,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
  * 
  *             if self.n_plp < 0:
  */
-    ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
+    ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
 
     /* "csamtools.pyx":1989
  *             self.cnext()
@@ -20144,7 +19086,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
  *                 raise ValueError("error during iteration" )
  * 
  */
-    __pyx_t_1 = (__pyx_v_self->__pyx_base.n_plp < 0);
+    __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp < 0);
     if (__pyx_t_1) {
 
       /* "csamtools.pyx":1990
@@ -20159,9 +19101,9 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
       __Pyx_Raise(__pyx_t_2, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L5;
+      goto __pyx_L7;
     }
-    __pyx_L5:;
+    __pyx_L7:;
 
     /* "csamtools.pyx":1993
  * 
@@ -20170,7 +19112,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
  *                 return makePileupProxy( &self.plp,
  *                                          self.tid,
  */
-    __pyx_t_1 = (__pyx_v_self->__pyx_base.plp != NULL);
+    __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp != NULL);
     if (__pyx_t_1) {
 
       /* "csamtools.pyx":1994
@@ -20189,14 +19131,14 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
  * 
  *             # otherwise, proceed to next reference or stop
  */
-      __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy((&__pyx_v_self->__pyx_base.plp), __pyx_v_self->__pyx_base.tid, __pyx_v_self->__pyx_base.pos, __pyx_v_self->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy((&((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno =  [...]
       __Pyx_GOTREF(__pyx_t_2);
       __pyx_r = __pyx_t_2;
       __pyx_t_2 = 0;
       goto __pyx_L0;
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
-    __pyx_L6:;
+    __pyx_L8:;
 
     /* "csamtools.pyx":2000
  * 
@@ -20205,7 +19147,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
  *             if self.tid < self.samfile.nreferences:
  *                 self.setupIteratorData( self.tid, 0, max_pos, 0 )
  */
-    __pyx_v_self->__pyx_base.tid = (__pyx_v_self->__pyx_base.tid + 1);
+    ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid + 1);
 
     /* "csamtools.pyx":2001
  *             # otherwise, proceed to next reference or stop
@@ -20214,9 +19156,9 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
  *                 self.setupIteratorData( self.tid, 0, max_pos, 0 )
  *             else:
  */
-    __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self->__pyx_base.samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -20235,10 +19177,10 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
  */
       __pyx_t_5.__pyx_n = 1;
       __pyx_t_5.reopen = 0;
-      __pyx_t_4 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_self->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE_ [...]
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      goto __pyx_L7;
+      goto __pyx_L9;
     }
     /*else*/ {
 
@@ -20252,7 +19194,7 @@ static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __
       __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
-    __pyx_L7:;
+    __pyx_L9:;
   }
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -20291,7 +19233,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src)
   int __pyx_t_4;
   PyObject *__pyx_t_5 = NULL;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("query_start", 0);
+  __Pyx_RefNannySetupContext("query_start");
   __Pyx_TraceCall("query_start", __pyx_f[0], 2009);
 
   /* "csamtools.pyx":2012
@@ -20473,7 +19415,7 @@ static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
   int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("query_end", 0);
+  __Pyx_RefNannySetupContext("query_end");
   __Pyx_TraceCall("query_end", __pyx_f[0], 2032);
 
   /* "csamtools.pyx":2035
@@ -20680,7 +19622,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("get_seq_range", 0);
+  __Pyx_RefNannySetupContext("get_seq_range");
   __Pyx_TraceCall("get_seq_range", __pyx_f[0], 2056);
 
   /* "csamtools.pyx":2061
@@ -20808,7 +19750,7 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("get_qual_range", 0);
+  __Pyx_RefNannySetupContext("get_qual_range");
   __Pyx_TraceCall("get_qual_range", __pyx_f[0], 2076);
 
   /* "csamtools.pyx":2081
@@ -20913,20 +19855,6 @@ static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
-    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
-  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead___init__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2124
  * 
  *     # Now only called when instances are created from Python
@@ -20935,12 +19863,16 @@ static int __pyx_pw_9csamtools_11AlignedRead_1__init__(PyObject *__pyx_v_self, P
  *         self._delegate = <bam1_t*>calloc( 1, sizeof( bam1_t) )
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__init__", 0);
+  __Pyx_RefNannySetupContext("__init__");
   __Pyx_TraceCall("__init__", __pyx_f[0], 2124);
+  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
 
   /* "csamtools.pyx":2126
  *     def __init__(self):
@@ -20949,7 +19881,7 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtool
  *         # allocate some memory
  *         # If size is 0, calloc does not return a pointer that can be passed to free()
  */
-  __pyx_v_self->_delegate = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
 
   /* "csamtools.pyx":2130
  *         # If size is 0, calloc does not return a pointer that can be passed to free()
@@ -20958,7 +19890,7 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtool
  *         self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )
  *         self._delegate.data_len = 0
  */
-  __pyx_v_self->_delegate->m_data = 40;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->m_data = 40;
 
   /* "csamtools.pyx":2131
  *         # so allocate 40 bytes for a new read
@@ -20967,7 +19899,7 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtool
  *         self._delegate.data_len = 0
  * 
  */
-  __pyx_v_self->_delegate->data = ((uint8_t *)calloc(__pyx_v_self->_delegate->m_data, 1));
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->data = ((uint8_t *)calloc(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->m_data, 1));
 
   /* "csamtools.pyx":2132
  *         self._delegate.m_data = 40
@@ -20976,7 +19908,7 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtool
  * 
  *     def __dealloc__(self):
  */
-  __pyx_v_self->_delegate->data_len = 0;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->data_len = 0;
 
   __pyx_r = 0;
   __Pyx_TraceReturn(Py_None);
@@ -20984,15 +19916,6 @@ static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_9csamtools_11AlignedRead_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_9csamtools_11AlignedRead_3__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_9csamtools_11AlignedRead_2__dealloc__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
 /* "csamtools.pyx":2134
  *         self._delegate.data_len = 0
  * 
@@ -21001,10 +19924,11 @@ static void __pyx_pw_9csamtools_11AlignedRead_3__dealloc__(PyObject *__pyx_v_sel
  * 
  */
 
-static void __pyx_pf_9csamtools_11AlignedRead_2__dealloc__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static void __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__", 0);
+  __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 2134);
 
   /* "csamtools.pyx":2135
@@ -21014,25 +19938,12 @@ static void __pyx_pf_9csamtools_11AlignedRead_2__dealloc__(struct __pyx_obj_9csa
  * 
  *     def __str__(self):
  */
-  bam_destroy1(__pyx_v_self->_delegate);
+  bam_destroy1(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate);
 
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5__str__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_4__str__[] = "return string representation of alignment.\n\n        The representation is an approximate :term:`sam` format.\n\n        An aligned read might not be associated with a :term:`Samfile`.\n        As a result :term:`tid` is shown instead of the reference name.\n\n        Similarly, the tags field is returned in its parsed state.\n        ";
-struct wrapperbase __pyx_wrapperbase_9csamtools_11AlignedRead_4__str__;
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5__str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4__str__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2137
  *         bam_destroy1(self._delegate)
  * 
@@ -21041,7 +19952,10 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5__str__(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_2__str__(PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_2__str__[] = "return string representation of alignment.\n\n        The representation is an approximate :term:`sam` format.\n\n        An aligned read might not be associated with a :term:`Samfile`.\n        As a result :term:`tid` is shown instead of the reference name.\n\n        Similarly, the tags field is returned in its parsed state.\n        ";
+struct wrapperbase __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__;
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_2__str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_v_seq = NULL;
   PyObject *__pyx_v_qual = NULL;
   PyObject *__pyx_r = NULL;
@@ -21063,7 +19977,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__str__", 0);
+  __Pyx_RefNannySetupContext("__str__");
   __Pyx_TraceCall("__str__", __pyx_f[0], 2137);
 
   /* "csamtools.pyx":2149
@@ -21095,7 +20009,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *             qual = self.qual
  *         else:
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_v_seq = __pyx_t_2;
     __pyx_t_2 = 0;
@@ -21107,11 +20021,11 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *         else:
  *             seq = self.seq.decode('ascii')
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_v_qual = __pyx_t_2;
     __pyx_t_2 = 0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -21122,7 +20036,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *             qual = self.qual.decode('ascii')
  *         return "\t".join(map(str, (self.qname,
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -21140,7 +20054,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *         return "\t".join(map(str, (self.qname,
  *                                    self.flag,
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -21151,7 +20065,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
     __pyx_v_qual = __pyx_t_2;
     __pyx_t_2 = 0;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2155
  *             seq = self.seq.decode('ascii')
@@ -21163,7 +20077,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
   __Pyx_XDECREF(__pyx_r);
   __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__qname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
   /* "csamtools.pyx":2156
@@ -21173,7 +20087,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *                                    self.rname,
  *                                    self.pos,
  */
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
 
   /* "csamtools.pyx":2157
@@ -21183,7 +20097,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *                                    self.pos,
  *                                    self.mapq,
  */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__rname); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rname); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
 
   /* "csamtools.pyx":2158
@@ -21193,7 +20107,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *                                    self.mapq,
  *                                    self.cigar,
  */
-  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
 
   /* "csamtools.pyx":2159
@@ -21203,7 +20117,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *                                    self.cigar,
  *                                    self.mrnm,
  */
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mapq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
 
   /* "csamtools.pyx":2160
@@ -21213,7 +20127,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *                                    self.mrnm,
  *                                    self.mpos,
  */
-  __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cigar); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
 
   /* "csamtools.pyx":2161
@@ -21223,7 +20137,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *                                    self.mpos,
  *                                    self.rlen,
  */
-  __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mrnm); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mrnm); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
 
   /* "csamtools.pyx":2162
@@ -21233,7 +20147,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *                                    self.rlen,
  *                                    seq,
  */
-  __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mpos); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mpos); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
 
   /* "csamtools.pyx":2163
@@ -21243,7 +20157,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  *                                    seq,
  *                                    qual,
  */
-  __pyx_t_11 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__rlen); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rlen); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_11);
 
   /* "csamtools.pyx":2166
@@ -21253,10 +20167,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
  * 
  *     def compare(self, AlignedRead other):
  */
-  __pyx_t_12 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tags); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tags); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
   __pyx_t_13 = PyTuple_New(12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4);
@@ -21294,7 +20208,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
   __pyx_t_11 = 0;
   __pyx_t_12 = 0;
   __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
   __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
@@ -21305,7 +20219,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
   __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
   PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
   __Pyx_GIVEREF(__pyx_t_13);
   __pyx_t_13 = 0;
@@ -21343,23 +20257,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_7compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_6compare[] = "AlignedRead.compare(self, AlignedRead other)\nreturn -1,0,1, if contents in this are binary <,=,> to *other*";
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_7compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("compare (wrapper)", 0);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_9csamtools_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_6compare(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_other));
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2168
  *                                    self.tags )))
  * 
@@ -21368,7 +20265,9 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_7compare(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_other) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_3compare[] = "AlignedRead.compare(self, AlignedRead other)\nreturn -1,0,1, if contents in this are binary <,=,> to *other*";
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
   int __pyx_v_retval;
   bam1_t *__pyx_v_t;
   bam1_t *__pyx_v_o;
@@ -21380,8 +20279,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("compare", 0);
+  __Pyx_RefNannySetupContext("compare");
   __Pyx_TraceCall("compare", __pyx_f[0], 2168);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_9csamtools_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":2174
  *         cdef bam1_t *t, *o
@@ -21390,7 +20290,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9cs
  *         o = other._delegate
  * 
  */
-  __pyx_v_t = __pyx_v_self->_delegate;
+  __pyx_v_t = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2175
  * 
@@ -21399,7 +20299,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9cs
  * 
  *         # uncomment for debugging purposes
  */
-  __pyx_v_o = __pyx_v_other->_delegate;
+  __pyx_v_o = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_other)->_delegate;
 
   /* "csamtools.pyx":2187
  * 
@@ -21422,9 +20322,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9cs
     __Pyx_INCREF(__pyx_int_0);
     __pyx_r = __pyx_int_0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2190
  *             return 0
@@ -21449,9 +20349,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9cs
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":2193
  * 
@@ -21476,9 +20376,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9cs
     __pyx_r = __pyx_t_2;
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L5;
+    goto __pyx_L7;
   }
-  __pyx_L5:;
+  __pyx_L7:;
 
   /* "csamtools.pyx":2195
  *         retval = (t.data_len > o.data_len) - (t.data_len < o.data_len) # cmp(t.data_len, o.data_len)
@@ -21507,17 +20407,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static Py_hash_t __pyx_pw_9csamtools_11AlignedRead_9__hash__(PyObject *__pyx_v_self); /*proto*/
-static Py_hash_t __pyx_pw_9csamtools_11AlignedRead_9__hash__(PyObject *__pyx_v_self) {
-  Py_hash_t __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8__hash__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2198
  * 
  *     # Disabled so long as __cmp__ is a special method
@@ -21526,11 +20415,12 @@ static Py_hash_t __pyx_pw_9csamtools_11AlignedRead_9__hash__(PyObject *__pyx_v_s
  * 
  */
 
-static Py_hash_t __pyx_pf_9csamtools_11AlignedRead_8__hash__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static Py_hash_t __pyx_pf_9csamtools_11AlignedRead_4__hash__(PyObject *__pyx_v_self); /*proto*/
+static Py_hash_t __pyx_pf_9csamtools_11AlignedRead_4__hash__(PyObject *__pyx_v_self) {
   Py_hash_t __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__hash__", 0);
+  __Pyx_RefNannySetupContext("__hash__");
   __Pyx_TraceCall("__hash__", __pyx_f[0], 2198);
 
   /* "csamtools.pyx":2199
@@ -21551,17 +20441,6 @@ static Py_hash_t __pyx_pf_9csamtools_11AlignedRead_8__hash__(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qname_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qname_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5qname___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2203
  *     property qname:
  *         """the query name (None if not present)"""
@@ -21570,7 +20449,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qname_1__get__(PyObject *__p
  *             src = self._delegate
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -21580,7 +20460,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2203);
 
   /* "csamtools.pyx":2205
@@ -21590,7 +20470,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(struct __pyx_o
  *             if src.core.l_qname == 0: return None
  *             return _charptr_to_str(<char *>bam1_qname( src ))
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2206
  *             cdef bam1_t * src
@@ -21605,9 +20485,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(struct __pyx_o
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2207
  *             src = self._delegate
@@ -21636,17 +20516,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_5qname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_5qname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qname));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2209
  *             return _charptr_to_str(<char *>bam1_qname( src ))
  * 
@@ -21655,7 +20524,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_5qname_3__set__(PyObject *__pyx_v_s
  *             qname = _force_bytes(qname)
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qname) {
+static int __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
   bam1_t *__pyx_v_src;
   int __pyx_v_l;
   char *__pyx_v_p;
@@ -21671,7 +20541,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_9c
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2209);
   __Pyx_INCREF(__pyx_v_qname);
 
@@ -21696,9 +20566,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_9c
   if (__pyx_t_5) {
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2211
  *         def __set__(self, qname ):
@@ -21720,7 +20590,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_9c
  *             p = bam1_qname( src )
  * 
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2217
  * 
@@ -21791,17 +20661,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5cigar_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5cigar_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5cigar___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2259
  * 
  *         """
@@ -21810,7 +20669,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5cigar_1__get__(PyObject *__p
  *             cdef bam1_t * src
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__pyx_v_self) {
   uint32_t *__pyx_v_cigar_p;
   bam1_t *__pyx_v_src;
   PyObject *__pyx_v_op = 0;
@@ -21827,7 +20687,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2259);
 
   /* "csamtools.pyx":2265
@@ -21837,7 +20697,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_o
  *             if src.core.n_cigar == 0: return None
  * 
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2266
  * 
@@ -21852,9 +20712,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_o
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2268
  *             if src.core.n_cigar == 0: return None
@@ -21864,7 +20724,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_o
  *             for k from 0 <= k < src.core.n_cigar:
  */
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_v_cigar = ((PyObject *)__pyx_t_2);
   __pyx_t_2 = 0;
 
@@ -21921,7 +20781,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_o
  * 
  */
     __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_op);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_op);
     __Pyx_GIVEREF(__pyx_v_op);
@@ -21963,17 +20823,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_5cigar_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_5cigar_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_values));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2276
  *             return cigar
  * 
@@ -21982,7 +20831,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_5cigar_3__set__(PyObject *__pyx_v_s
  *             cdef uint32_t * p
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_values) {
+static int __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
   uint32_t *__pyx_v_p;
   bam1_t *__pyx_v_src;
   PyObject *__pyx_v_op = 0;
@@ -22006,7 +20856,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9c
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2276);
 
   /* "csamtools.pyx":2277
@@ -22030,9 +20880,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9c
   if (__pyx_t_5) {
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2283
  *             cdef int k
@@ -22050,7 +20900,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9c
  * 
  *             # get location of cigar string
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2288
  * 
@@ -22114,10 +20964,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9c
     __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
+    if (PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
       __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
-    } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
+    } else if (PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
       __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
     } else {
@@ -22159,19 +21009,19 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9c
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
-      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
+      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_8);
-      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
+      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_9);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      goto __pyx_L7_unpacking_done;
-      __pyx_L6_unpacking_failed:;
+      goto __pyx_L9_unpacking_done;
+      __pyx_L8_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
       if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_L7_unpacking_done:;
+      __pyx_L9_unpacking_done:;
     }
     __Pyx_XDECREF(__pyx_v_op);
     __pyx_v_op = __pyx_t_8;
@@ -22234,17 +21084,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_11cigarstring_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_11cigarstring_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2316
  *         Returns the empty string if not present.
  *         '''
@@ -22253,7 +21092,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_11cigarstring_1__get__(PyObje
  *             if c == None: return ""
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_v_c = NULL;
   PyObject *__pyx_v_x = NULL;
   PyObject *__pyx_v_y = NULL;
@@ -22275,7 +21115,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2316);
 
   /* "csamtools.pyx":2317
@@ -22285,7 +21125,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
  *             if c == None: return ""
  *             else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c])
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cigar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_v_c = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -22306,7 +21146,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
     __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
     __pyx_r = ((PyObject *)__pyx_kp_s_16);
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -22321,7 +21161,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
     __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_16), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     if (PyList_CheckExact(__pyx_v_c) || PyTuple_CheckExact(__pyx_v_c)) {
       __pyx_t_4 = __pyx_v_c; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
       __pyx_t_6 = NULL;
@@ -22331,10 +21171,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
       __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+      if (PyList_CheckExact(__pyx_t_4)) {
         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+      } else if (PyTuple_CheckExact(__pyx_t_4)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
       } else {
@@ -22376,19 +21216,19 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
-        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
+        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_8);
-        index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
+        index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_9);
         if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        goto __pyx_L7_unpacking_done;
-        __pyx_L6_unpacking_failed:;
+        goto __pyx_L9_unpacking_done;
+        __pyx_L8_unpacking_failed:;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
         if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_L7_unpacking_done:;
+        __pyx_L9_unpacking_done:;
       }
       __Pyx_XDECREF(__pyx_v_x);
       __pyx_v_x = __pyx_t_8;
@@ -22400,7 +21240,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
       __pyx_t_7 = PyInt_FromLong((__pyx_v_9csamtools_CODE2CIGAR[__pyx_t_12])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_9));
       PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __Pyx_INCREF(__pyx_v_y);
@@ -22415,7 +21255,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
     }
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_INCREF(((PyObject *)__pyx_t_3));
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
@@ -22428,7 +21268,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
     __pyx_t_3 = 0;
     goto __pyx_L0;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -22452,17 +21292,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_11cigarstring_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cigar); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_11cigarstring_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cigar) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_cigar));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2321
  *             else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c])
  * 
@@ -22471,7 +21300,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_11cigarstring_3__set__(PyObject *__
  *             parts = CIGAR_REGEX.findall( cigar )
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_cigar) {
+static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cigar); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cigar) {
   PyObject *__pyx_v_parts = NULL;
   PyObject *__pyx_v_x = NULL;
   PyObject *__pyx_v_y = NULL;
@@ -22493,7 +21323,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2321);
 
   /* "csamtools.pyx":2322
@@ -22516,12 +21346,12 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
   }
   if (__pyx_t_5) {
     __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cigar, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2323
  *         def __set__(self, cigar):
@@ -22536,7 +21366,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_cigar);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_cigar);
   __Pyx_GIVEREF(__pyx_v_cigar);
@@ -22555,7 +21385,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
  *     property seq:
  */
   __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
   if (PyList_CheckExact(__pyx_v_parts) || PyTuple_CheckExact(__pyx_v_parts)) {
     __pyx_t_1 = __pyx_v_parts; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
     __pyx_t_8 = NULL;
@@ -22565,10 +21395,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
     __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_1)) {
+    if (PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
       __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
-    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_1)) {
+    } else if (PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
       __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
     } else {
@@ -22610,19 +21440,19 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
       __Pyx_GOTREF(__pyx_t_11);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
-      index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
+      index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_9);
-      index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed;
+      index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L8_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_10);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      goto __pyx_L7_unpacking_done;
-      __pyx_L6_unpacking_failed:;
+      goto __pyx_L9_unpacking_done;
+      __pyx_L8_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
       if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
       if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_L7_unpacking_done:;
+      __pyx_L9_unpacking_done:;
     }
     __Pyx_XDECREF(__pyx_v_x);
     __pyx_v_x = __pyx_t_9;
@@ -22633,7 +21463,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
     __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__CIGAR2CODE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
     __Pyx_INCREF(__pyx_v_x);
     PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_x);
     __Pyx_GIVEREF(__pyx_v_x);
@@ -22645,7 +21475,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     __Pyx_INCREF(__pyx_v_y);
     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_y);
     __Pyx_GIVEREF(__pyx_v_y);
@@ -22653,7 +21483,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
     PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
@@ -22664,7 +21494,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
     __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cigar, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
 
   __pyx_r = 0;
@@ -22687,17 +21517,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_3seq_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_3seq_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3seq___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2330
  * 
  *         In Python 3, this property is of type bytes and assigning a unicode string to it consisting of ASCII characters only will work, but is inefficient."""
@@ -22706,7 +21525,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_3seq_1__get__(PyObject *__pyx
  *             cdef char * s
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -22716,7 +21536,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2330);
 
   /* "csamtools.pyx":2333
@@ -22726,7 +21546,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj
  * 
  *             if src.core.l_qseq == 0: return None
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2335
  *             src = self._delegate
@@ -22741,9 +21561,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2337
  *             if src.core.l_qseq == 0: return None
@@ -22772,17 +21592,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_3seq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_3seq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_seq));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2339
  *             return get_seq_range(src, 0, src.core.l_qseq)
  * 
@@ -22791,7 +21600,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_3seq_3__set__(PyObject *__pyx_v_sel
  *             # if no quality information is present, the first byte says 0xff.
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_seq) {
+static int __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) {
   bam1_t *__pyx_v_src;
   uint8_t *__pyx_v_p;
   char *__pyx_v_s;
@@ -22813,7 +21623,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2339);
   __Pyx_INCREF(__pyx_v_seq);
 
@@ -22838,9 +21648,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_9csa
   if (__pyx_t_5) {
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2344
  * 
@@ -22862,7 +21672,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_9csa
  * 
  *             l = len(seq)
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2352
  *             src = self._delegate
@@ -23002,17 +21812,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qual_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qual_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4qual___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2384
  * 
  *         In Python 3, this property is of type bytes and assigning a unicode string to it consisting of ASCII characters only will work, but is inefficient."""
@@ -23021,7 +21820,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qual_1__get__(PyObject *__py
  *             cdef bam1_t * src
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -23031,7 +21831,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2384);
 
   /* "csamtools.pyx":2389
@@ -23041,7 +21841,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(struct __pyx_ob
  * 
  *             if src.core.l_qseq == 0: return None
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2391
  *             src = self._delegate
@@ -23056,9 +21856,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(struct __pyx_ob
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2393
  *             if src.core.l_qseq == 0: return None
@@ -23087,17 +21887,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_4qual_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_4qual_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qual));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2395
  *             return get_qual_range(src, 0, src.core.l_qseq)
  * 
@@ -23106,7 +21895,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_4qual_3__set__(PyObject *__pyx_v_se
  *             cdef bam1_t * src
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual) {
+static int __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
   bam1_t *__pyx_v_src;
   uint8_t *__pyx_v_p;
   char *__pyx_v_q;
@@ -23127,7 +21917,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2395);
   __Pyx_INCREF(__pyx_v_qual);
 
@@ -23138,7 +21928,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9cs
  *             p = bam1_qual( src )
  *             if qual == None or len(qual) == 0:
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2403
  * 
@@ -23187,9 +21977,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9cs
  */
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2408
  *                 p[0] = 0xff
@@ -23246,7 +22036,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9cs
     __pyx_t_7 = __Pyx_PyInt_to_py_int32_t(__pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
@@ -23257,7 +22047,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9cs
     __Pyx_GOTREF(((PyObject *)__pyx_t_7));
     __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
     __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
     __pyx_t_7 = 0;
@@ -23267,9 +22057,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9cs
     __Pyx_Raise(__pyx_t_7, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":2415
  *             if src.core.l_qseq != l:
@@ -23320,17 +22110,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5query_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5query_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5query___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2431
  *         were not considered for alignment may have been retained."""
  * 
@@ -23339,7 +22118,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5query_1__get__(PyObject *__p
  *             cdef uint32_t start, end
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   uint32_t __pyx_v_start;
   uint32_t __pyx_v_end;
@@ -23352,7 +22132,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2431);
 
   /* "csamtools.pyx":2436
@@ -23362,7 +22142,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(struct __pyx_o
  * 
  *             if src.core.l_qseq == 0: return None
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2438
  *             src = self._delegate
@@ -23377,9 +22157,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(struct __pyx_o
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2440
  *             if src.core.l_qseq == 0: return None
@@ -23428,17 +22208,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qqual_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qqual_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5qqual___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2449
  * 
  *         In Python 3, this property is of type bytes."""
@@ -23447,7 +22216,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qqual_1__get__(PyObject *__p
  *             cdef uint32_t start, end
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   uint32_t __pyx_v_start;
   uint32_t __pyx_v_end;
@@ -23460,7 +22230,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2449);
 
   /* "csamtools.pyx":2453
@@ -23470,7 +22240,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_o
  * 
  *             if src.core.l_qseq == 0: return None
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2455
  *             src = self._delegate
@@ -23485,9 +22255,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_o
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2457
  *             if src.core.l_qseq == 0: return None
@@ -23536,17 +22306,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_6qstart_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_6qstart_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_6qstart___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2464
  *     property qstart:
  *         """start index of the aligned query portion of the sequence (0-based, inclusive)"""
@@ -23555,7 +22314,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_6qstart_1__get__(PyObject *__
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -23564,7 +22324,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2464);
 
   /* "csamtools.pyx":2465
@@ -23575,7 +22335,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_
  *     property qend:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_9csamtools_query_start(__pyx_v_self->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_query_start(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
@@ -23595,17 +22355,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qend_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qend_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4qend___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2469
  *     property qend:
  *         """end index of the aligned query portion of the sequence (0-based, exclusive)"""
@@ -23614,7 +22363,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qend_1__get__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -23623,7 +22373,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2469);
 
   /* "csamtools.pyx":2470
@@ -23634,7 +22384,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(struct __pyx_ob
  *     property qlen:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_9csamtools_query_end(__pyx_v_self->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_query_end(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
@@ -23654,17 +22404,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qlen_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qlen_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4qlen___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2474
  *     property qlen:
  *         """Length of the aligned query sequence"""
@@ -23673,7 +22412,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qlen_1__get__(PyObject *__py
  *             src = self._delegate
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -23684,7 +22424,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2474);
 
   /* "csamtools.pyx":2476
@@ -23694,7 +22434,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_ob
  *             return query_end(src)-query_start(src)
  * 
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2477
  *             cdef bam1_t * src
@@ -23725,17 +22465,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tags_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tags_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4tags___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2494
  *         multiple times.
  *         """
@@ -23744,7 +22473,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tags_1__get__(PyObject *__py
  *             cdef bam1_t * src
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   uint8_t *__pyx_v_s;
   char __pyx_v_auxtag[3];
@@ -23773,7 +22503,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2494);
 
   /* "csamtools.pyx":2503
@@ -23783,7 +22513,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *             if src.l_aux == 0: return []
  *             s = bam1_aux( src )
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2504
  * 
@@ -23796,13 +22526,13 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
   if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2505
  *             src = self._delegate
@@ -23821,7 +22551,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *             while s < (src.data + src.data_len):
  */
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_v_result = __pyx_t_2;
   __pyx_t_2 = 0;
 
@@ -23920,7 +22650,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *                     value = <int>bam_aux2i(s)
  */
       __pyx_v_s = (__pyx_v_s + 1);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
     /* "csamtools.pyx":2517
@@ -23962,7 +22692,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *                     value = <int32_t>bam_aux2i(s)
  */
       __pyx_v_s = (__pyx_v_s + 2);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
     /* "csamtools.pyx":2520
@@ -24004,7 +22734,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *                     value = <float>bam_aux2f(s)
  */
       __pyx_v_s = (__pyx_v_s + 4);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
     /* "csamtools.pyx":2523
@@ -24038,7 +22768,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *                     value = <double>bam_aux2d(s)
  */
       __pyx_v_s = (__pyx_v_s + 4);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
     /* "csamtools.pyx":2526
@@ -24072,7 +22802,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *                     value = "%c" % <char>bam_aux2A(s)
  */
       __pyx_v_s = (__pyx_v_s + 8);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
     /* "csamtools.pyx":2529
@@ -24109,7 +22839,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *                     value = _charptr_to_str(<char*>bam_aux2Z(s))
  */
       __pyx_v_s = (__pyx_v_s + 1);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
     /* "csamtools.pyx":2532
@@ -24152,7 +22882,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  */
       __pyx_t_7 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_v_s = (__pyx_v_s + (__pyx_t_7 + 1));
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
     /* "csamtools.pyx":2536
@@ -24214,21 +22944,21 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
-        index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
+        index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_2);
-        index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
+        index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_8);
-        index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
+        index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_9);
         if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        goto __pyx_L8_unpacking_done;
-        __pyx_L7_unpacking_failed:;
+        goto __pyx_L10_unpacking_done;
+        __pyx_L9_unpacking_failed:;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
         if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_L8_unpacking_done:;
+        __pyx_L10_unpacking_done:;
       }
       __pyx_t_12 = __Pyx_PyInt_from_py_uint8_t(__pyx_t_2); if (unlikely((__pyx_t_12 == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -24248,9 +22978,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  *                 s += 1
  */
       __pyx_v_s = (__pyx_v_s + ((5 + (__pyx_v_nvalues * __pyx_v_byte_size)) - 1));
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
-    __pyx_L6:;
+    __pyx_L8:;
 
     /* "csamtools.pyx":2542
  *                     s += 5 + ( nvalues * byte_size) - 1
@@ -24268,11 +22998,13 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
  * 
  *             return result
  */
+    if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
     __pyx_t_6 = __pyx_f_9csamtools__charptr_to_str(__pyx_v_auxtag); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    if (unlikely(!__pyx_v_value)) { __Pyx_RaiseUnboundLocalError("value"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    if (unlikely(!__pyx_v_value)) { __Pyx_RaiseUnboundLocalError("value"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
     __Pyx_GIVEREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_v_value);
@@ -24314,17 +23046,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_4tags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_4tags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tags));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2548
  *             return result
  * 
@@ -24333,7 +23054,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_4tags_3__set__(PyObject *__pyx_v_se
  *             cdef uint8_t * s
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tags) {
+static int __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags) {
   bam1_t *__pyx_v_src;
   uint8_t *__pyx_v_s;
   char *__pyx_v_temp;
@@ -24375,7 +23097,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2548);
 
   /* "csamtools.pyx":2554
@@ -24385,7 +23107,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  * 
  *             fmts, args = ["<"], []
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2556
  *             src = self._delegate
@@ -24395,12 +23117,12 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  *             if tags != None:
  */
   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_138));
   PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_138));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_138));
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_v_fmts = __pyx_t_1;
   __pyx_t_1 = 0;
   __pyx_v_args = __pyx_t_2;
@@ -24435,10 +23157,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
       __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
+      if (PyList_CheckExact(__pyx_t_2)) {
         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
         __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
+      } else if (PyTuple_CheckExact(__pyx_t_2)) {
         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
         __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
       } else {
@@ -24480,19 +23202,19 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-        index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
+        index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_6);
-        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
+        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_7);
         if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        goto __pyx_L7_unpacking_done;
-        __pyx_L6_unpacking_failed:;
+        goto __pyx_L9_unpacking_done;
+        __pyx_L8_unpacking_failed:;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
         if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_L7_unpacking_done:;
+        __pyx_L9_unpacking_done:;
       }
       __Pyx_XDECREF(__pyx_v_pytag);
       __pyx_v_pytag = __pyx_t_6;
@@ -24527,9 +23249,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
         __Pyx_DECREF(__pyx_v_pytag);
         __pyx_v_pytag = __pyx_t_7;
         __pyx_t_7 = 0;
-        goto __pyx_L8;
+        goto __pyx_L10;
       }
-      __pyx_L8:;
+      __pyx_L10:;
 
       /* "csamtools.pyx":2564
  *                     if not type(pytag) is bytes:
@@ -24599,7 +23321,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
           __Pyx_XDECREF(__pyx_v_datatype);
           __pyx_v_datatype = __pyx_t_1;
           __pyx_t_1 = 0;
-          goto __pyx_L10;
+          goto __pyx_L12;
         }
         /*else*/ {
 
@@ -24611,7 +23333,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  *                             # signed ints
  */
           __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
           __Pyx_INCREF(__pyx_v_value);
           PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
           __Pyx_GIVEREF(__pyx_v_value);
@@ -24619,7 +23341,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
           __Pyx_GOTREF(__pyx_t_7);
           __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
           __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
+          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
           __Pyx_INCREF(__pyx_v_value);
           PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
           __Pyx_GIVEREF(__pyx_v_value);
@@ -24697,7 +23419,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __Pyx_XDECREF(__pyx_v_datatype);
               __pyx_v_datatype = __pyx_t_6;
               __pyx_t_6 = 0;
-              goto __pyx_L12;
+              goto __pyx_L14;
             }
 
             /* "csamtools.pyx":2578
@@ -24722,7 +23444,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __Pyx_XDECREF(__pyx_v_datatype);
               __pyx_v_datatype = __pyx_t_1;
               __pyx_t_1 = 0;
-              goto __pyx_L12;
+              goto __pyx_L14;
             }
 
             /* "csamtools.pyx":2579
@@ -24740,7 +23462,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(((PyObject *)__pyx_t_1));
               __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              __Pyx_GOTREF(__pyx_t_6);
+              __Pyx_GOTREF(((PyObject *)__pyx_t_6));
               PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
               __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
               __pyx_t_1 = 0;
@@ -24750,7 +23472,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __Pyx_Raise(__pyx_t_1, 0, 0, 0);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              goto __pyx_L12;
+              goto __pyx_L14;
             }
             /*else*/ {
 
@@ -24772,8 +23494,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __pyx_v_datatype = __pyx_t_6;
               __pyx_t_6 = 0;
             }
-            __pyx_L12:;
-            goto __pyx_L11;
+            __pyx_L14:;
+            goto __pyx_L13;
           }
           /*else*/ {
 
@@ -24799,7 +23521,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __Pyx_XDECREF(__pyx_v_datatype);
               __pyx_v_datatype = __pyx_t_1;
               __pyx_t_1 = 0;
-              goto __pyx_L13;
+              goto __pyx_L15;
             }
 
             /* "csamtools.pyx":2585
@@ -24824,7 +23546,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __Pyx_XDECREF(__pyx_v_datatype);
               __pyx_v_datatype = __pyx_t_6;
               __pyx_t_6 = 0;
-              goto __pyx_L13;
+              goto __pyx_L15;
             }
 
             /* "csamtools.pyx":2586
@@ -24842,7 +23564,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               __Pyx_GOTREF(((PyObject *)__pyx_t_6));
               __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              __Pyx_GOTREF(__pyx_t_1);
+              __Pyx_GOTREF(((PyObject *)__pyx_t_1));
               PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
               __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
               __pyx_t_6 = 0;
@@ -24852,7 +23574,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __Pyx_Raise(__pyx_t_6, 0, 0, 0);
               __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
               {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              goto __pyx_L13;
+              goto __pyx_L15;
             }
             /*else*/ {
 
@@ -24874,11 +23596,11 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
               __pyx_v_datatype = __pyx_t_1;
               __pyx_t_1 = 0;
             }
-            __pyx_L13:;
+            __pyx_L15:;
           }
-          __pyx_L11:;
+          __pyx_L13:;
         }
-        __pyx_L10:;
+        __pyx_L12:;
 
         /* "csamtools.pyx":2589
  *                                 else: datafmt, datatype = "I", 'I'
@@ -24891,7 +23613,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
         __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
         __Pyx_GIVEREF(__pyx_t_1);
         __Pyx_INCREF(__pyx_v_datafmt);
@@ -24962,7 +23684,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
         __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_14 = PyList_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_14);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_14));
         PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
         PyList_SET_ITEM(__pyx_t_14, 1, __pyx_t_8);
@@ -24976,7 +23698,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
         __pyx_t_13 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_value);
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_value);
         __Pyx_GIVEREF(__pyx_v_value);
@@ -24988,7 +23710,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
         __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
         __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_13);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_13));
         PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_7));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
         __pyx_t_7 = 0;
@@ -25005,6 +23727,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  *                         continue
  * 
  */
+        if (unlikely(((PyObject *)__pyx_v_fmts) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_15 = PyList_Append(__pyx_v_fmts, __pyx_v_datafmt); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
         /* "csamtools.pyx":2595
@@ -25014,10 +23739,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  * 
  *                     if t is float:
  */
-        goto __pyx_L4_continue;
-        goto __pyx_L9;
+        goto __pyx_L6_continue;
+        goto __pyx_L11;
       }
-      __pyx_L9:;
+      __pyx_L11:;
 
       /* "csamtools.pyx":2597
  *                         continue
@@ -25046,7 +23771,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
         __Pyx_XDECREF(__pyx_v_pytype);
         __pyx_v_pytype = __pyx_t_13;
         __pyx_t_13 = 0;
-        goto __pyx_L14;
+        goto __pyx_L16;
       }
 
       /* "csamtools.pyx":2599
@@ -25094,7 +23819,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __Pyx_XDECREF(__pyx_v_pytype);
             __pyx_v_pytype = __pyx_t_7;
             __pyx_t_7 = 0;
-            goto __pyx_L16;
+            goto __pyx_L18;
           }
 
           /* "csamtools.pyx":2603
@@ -25119,7 +23844,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __Pyx_XDECREF(__pyx_v_pytype);
             __pyx_v_pytype = __pyx_t_13;
             __pyx_t_13 = 0;
-            goto __pyx_L16;
+            goto __pyx_L18;
           }
 
           /* "csamtools.pyx":2604
@@ -25137,7 +23862,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __pyx_t_13 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_13));
             __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(__pyx_t_7);
+            __Pyx_GOTREF(((PyObject *)__pyx_t_7));
             PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_13));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_13));
             __pyx_t_13 = 0;
@@ -25147,7 +23872,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __Pyx_Raise(__pyx_t_13, 0, 0, 0);
             __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            goto __pyx_L16;
+            goto __pyx_L18;
           }
           /*else*/ {
 
@@ -25169,8 +23894,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __pyx_v_pytype = __pyx_t_7;
             __pyx_t_7 = 0;
           }
-          __pyx_L16:;
-          goto __pyx_L15;
+          __pyx_L18:;
+          goto __pyx_L17;
         }
         /*else*/ {
 
@@ -25196,7 +23921,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __Pyx_XDECREF(__pyx_v_pytype);
             __pyx_v_pytype = __pyx_t_13;
             __pyx_t_13 = 0;
-            goto __pyx_L17;
+            goto __pyx_L19;
           }
 
           /* "csamtools.pyx":2609
@@ -25221,7 +23946,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __Pyx_XDECREF(__pyx_v_pytype);
             __pyx_v_pytype = __pyx_t_7;
             __pyx_t_7 = 0;
-            goto __pyx_L17;
+            goto __pyx_L19;
           }
 
           /* "csamtools.pyx":2610
@@ -25239,7 +23964,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(((PyObject *)__pyx_t_7));
             __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(__pyx_t_13);
+            __Pyx_GOTREF(((PyObject *)__pyx_t_13));
             PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_7));
             __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
             __pyx_t_7 = 0;
@@ -25249,7 +23974,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __Pyx_Raise(__pyx_t_7, 0, 0, 0);
             __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            goto __pyx_L17;
+            goto __pyx_L19;
           }
           /*else*/ {
 
@@ -25271,10 +23996,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
             __pyx_v_pytype = __pyx_t_13;
             __pyx_t_13 = 0;
           }
-          __pyx_L17:;
+          __pyx_L19:;
         }
-        __pyx_L15:;
-        goto __pyx_L14;
+        __pyx_L17:;
+        goto __pyx_L16;
       }
       /*else*/ {
 
@@ -25303,9 +24028,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
           __Pyx_DECREF(__pyx_v_value);
           __pyx_v_value = __pyx_t_7;
           __pyx_t_7 = 0;
-          goto __pyx_L18;
+          goto __pyx_L20;
         }
-        __pyx_L18:;
+        __pyx_L20:;
 
         /* "csamtools.pyx":2616
  *                         if t is not bytes:
@@ -25335,7 +24060,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
           __Pyx_XDECREF(__pyx_v_pytype);
           __pyx_v_pytype = __pyx_t_13;
           __pyx_t_13 = 0;
-          goto __pyx_L19;
+          goto __pyx_L21;
         }
         /*else*/ {
 
@@ -25361,9 +24086,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
           __pyx_v_pytype = __pyx_t_13;
           __pyx_t_13 = 0;
         }
-        __pyx_L19:;
+        __pyx_L21:;
       }
-      __pyx_L14:;
+      __pyx_L16:;
 
       /* "csamtools.pyx":2621
  *                             fmt, pytype = "2sc%is" % (len(value)+1), 'Z'
@@ -25398,7 +24123,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  *                     fmts.append( fmt )
  */
       __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
       PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_14);
@@ -25409,7 +24134,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
       __pyx_t_7 = 0;
       __pyx_t_14 = 0;
       __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_14);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
       PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
@@ -25426,8 +24151,11 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  * 
  *                 fmt = "".join(fmts)
  */
+      if (unlikely(((PyObject *)__pyx_v_fmts) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
       __pyx_t_15 = PyList_Append(__pyx_v_fmts, __pyx_v_fmt); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_L4_continue:;
+      __pyx_L6_continue:;
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -25441,7 +24169,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
     __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_16), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(((PyObject *)__pyx_v_fmts));
     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fmts));
     __Pyx_GIVEREF(((PyObject *)__pyx_v_fmts));
@@ -25466,7 +24194,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
     __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_14);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
     __Pyx_INCREF(__pyx_v_fmt);
     PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_fmt);
     __Pyx_GIVEREF(__pyx_v_fmt);
@@ -25490,7 +24218,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
     __Pyx_GOTREF(__pyx_t_14);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_total_size);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_total_size);
     __Pyx_GIVEREF(__pyx_v_total_size);
@@ -25522,7 +24250,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  *                                   *args )
  */
     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_fmt);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fmt);
     __Pyx_GIVEREF(__pyx_v_fmt);
@@ -25551,19 +24279,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
-
-  /* "csamtools.pyx":2640
- *             pysam_bam_update( src,
- *                               src.l_aux,
- *                               total_size,             # <<<<<<<<<<<<<<
- *                               bam1_aux( src ) )
- * 
- */
-  if (unlikely(!__pyx_v_total_size)) { __Pyx_RaiseUnboundLocalError("total_size"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-  __pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_total_size); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_L5:;
+  if (unlikely(!__pyx_v_total_size)) { __Pyx_RaiseUnboundLocalError("total_size"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_total_size); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":2641
  *                               src.l_aux,
@@ -25605,6 +24324,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  *                 # check if there is direct path from buffer.raw to tmp
  */
     __pyx_v_s = bam1_aux(__pyx_v_src);
+    if (unlikely(!__pyx_v_buffer)) { __Pyx_RaiseUnboundLocalError("buffer"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_14 = PyObject_GetAttr(__pyx_v_buffer, __pyx_n_s__raw); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "csamtools.pyx":2652
  * 
@@ -25613,8 +24333,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  *                 memcpy( s, temp, total_size )
  * 
  */
-    if (unlikely(!__pyx_v_buffer)) { __Pyx_RaiseUnboundLocalError("buffer"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-    __pyx_t_14 = PyObject_GetAttr(__pyx_v_buffer, __pyx_n_s__raw); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
     __pyx_t_18 = PyBytes_AsString(__pyx_t_14); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
@@ -25629,9 +24347,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
  */
     __pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_total_size); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     memcpy(__pyx_v_s, __pyx_v_temp, __pyx_t_16);
-    goto __pyx_L20;
+    goto __pyx_L22;
   }
-  __pyx_L20:;
+  __pyx_L22:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -25665,17 +24383,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4flag_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4flag_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4flag___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2657
  *     property flag:
  *         """properties flag"""
@@ -25684,7 +24391,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4flag_1__get__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -25692,10 +24400,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2657);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_delegate->core.flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -25714,17 +24422,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_4flag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_4flag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4flag_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_flag));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2658
  *         """properties flag"""
  *         def __get__(self): return self._delegate.core.flag
@@ -25733,7 +24430,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_4flag_3__set__(PyObject *__pyx_v_se
  *     property rname:
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_flag) {
+static int __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   uint32_t __pyx_t_1;
@@ -25741,10 +24439,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2658);
   __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_flag); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.flag = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -25757,17 +24455,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rname_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rname_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5rname___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2676
  * 
  *         """
@@ -25776,7 +24463,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rname_1__get__(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -25784,10 +24472,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2676);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -25806,17 +24494,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_5rname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_5rname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5rname_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2677
  *         """
  *         def __get__(self): return self._delegate.core.tid
@@ -25825,7 +24502,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_5rname_3__set__(PyObject *__pyx_v_s
  *     property tid:
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid) {
+static int __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -25833,10 +24511,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx_obj_9c
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2677);
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.tid = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -25849,17 +24527,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_3tid_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3tid___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2690
  * 
  *         """
@@ -25868,7 +24535,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_3tid_1__get__(PyObject *__pyx
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -25876,10 +24544,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2690);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -25898,17 +24566,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_3tid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_3tid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3tid_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2691
  *         """
  *         def __get__(self): return self._delegate.core.tid
@@ -25917,7 +24574,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_3tid_3__set__(PyObject *__pyx_v_sel
  *     property pos:
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid) {
+static int __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -25925,10 +24583,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2691);
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.tid = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -25941,17 +24599,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_3pos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3pos___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2695
  *     property pos:
  *         """0-based leftmost coordinate"""
@@ -25960,7 +24607,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_3pos_1__get__(PyObject *__pyx
  *             ## setting the cigar string also updates the "bin" attribute
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -25968,10 +24616,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2695);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -25990,17 +24638,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_3pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_3pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_pos));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2696
  *         """0-based leftmost coordinate"""
  *         def __get__(self): return self._delegate.core.pos
@@ -26009,7 +24646,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_3pos_3__set__(PyObject *__pyx_v_sel
  *             cdef bam1_t * src
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_pos) {
+static int __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos) {
   bam1_t *__pyx_v_src;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
@@ -26018,7 +24656,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2696);
 
   /* "csamtools.pyx":2699
@@ -26028,7 +24666,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csa
  *             if src.core.n_cigar:
  *                 src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2700
  *             cdef bam1_t * src
@@ -26047,7 +24685,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csa
  *                 src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)
  */
     __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)));
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -26060,7 +24698,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csa
  */
     __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, (__pyx_v_src->core.pos + 1));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2704
  *             else:
@@ -26070,7 +24708,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csa
  *         """properties bin"""
  */
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_pos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.pos = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -26083,17 +24721,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_3bin_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_3bin_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3bin___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2707
  *     property bin:
  *         """properties bin"""
@@ -26102,7 +24729,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_3bin_1__get__(PyObject *__pyx
  *     property rlen:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -26110,10 +24738,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2707);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_delegate->core.bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26132,17 +24760,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_3bin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_3bin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3bin_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_bin));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2708
  *         """properties bin"""
  *         def __get__(self): return self._delegate.core.bin
@@ -26151,7 +24768,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_3bin_3__set__(PyObject *__pyx_v_sel
  *         '''length of the read (read only). Returns 0 if not given.'''
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_bin) {
+static int __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   uint32_t __pyx_t_1;
@@ -26159,10 +24777,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2708);
   __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_bin); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.bin = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -26175,17 +24793,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4rlen_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4rlen_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4rlen___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2711
  *     property rlen:
  *         '''length of the read (read only). Returns 0 if not given.'''
@@ -26194,7 +24801,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4rlen_1__get__(PyObject *__py
  *         '''aligned reference position of the read on the reference genome.
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -26202,10 +24810,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2711);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.l_qseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.l_qseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26224,17 +24832,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4aend_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4aend_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4aend___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2717
  *         aend points to one past the last aligned residue.
  *         Returns None if not available.'''
@@ -26243,7 +24840,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4aend_1__get__(PyObject *__py
  *             src = self._delegate
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -26256,7 +24854,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2717);
 
   /* "csamtools.pyx":2719
@@ -26266,7 +24864,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_ob
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2720
  *             cdef bam1_t * src
@@ -26275,7 +24873,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_ob
  *                 return None
  *             return bam_calend(&src.core, bam1_cigar(src))
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -26301,9 +24899,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_ob
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2722
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
@@ -26333,17 +24931,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4alen_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4alen_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4alen___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2727
  *         '''aligned length of the read on the reference genome.  Returns None if
  *         not available.'''
@@ -26352,7 +24939,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4alen_1__get__(PyObject *__py
  *             src = self._delegate
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx_v_self) {
   bam1_t *__pyx_v_src;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -26365,7 +24953,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2727);
 
   /* "csamtools.pyx":2729
@@ -26375,7 +24963,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_ob
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2730
  *             cdef bam1_t * src
@@ -26384,7 +24972,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_ob
  *                 return None
  *             return bam_calend(&src.core,
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -26410,9 +24998,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_ob
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2732
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
@@ -26430,7 +25018,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_ob
  * 
  *     property mapq:
  */
-  __pyx_t_2 = PyInt_FromLong((bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)) - __pyx_v_self->_delegate->core.pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong((bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)) - ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_r = __pyx_t_2;
   __pyx_t_2 = 0;
@@ -26450,17 +25038,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mapq_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mapq_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mapq___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2738
  *     property mapq:
  *         """mapping quality"""
@@ -26469,7 +25046,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mapq_1__get__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -26477,10 +25055,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2738);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_delegate->core.qual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26499,17 +25077,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_4mapq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_4mapq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mapq_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qual));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2739
  *         """mapping quality"""
  *         def __get__(self): return self._delegate.core.qual
@@ -26518,7 +25085,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_4mapq_3__set__(PyObject *__pyx_v_se
  *     property mrnm:
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual) {
+static int __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   uint32_t __pyx_t_1;
@@ -26526,10 +25094,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2739);
   __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_qual); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.qual = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -26542,17 +25110,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mrnm_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mrnm_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2745
  *         deprecated, use RNEXT instead.
  *         """
@@ -26561,7 +25118,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mrnm_1__get__(PyObject *__py
  *     property rnext:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -26569,10 +25127,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2745);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26591,17 +25149,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_4mrnm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_4mrnm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mrnm_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mtid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2746
  *         """
  *         def __get__(self): return self._delegate.core.mtid
@@ -26610,7 +25157,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_4mrnm_3__set__(PyObject *__pyx_v_se
  *         """the :term:`reference` id of the mate """
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid) {
+static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -26618,10 +25166,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2746);
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.mtid = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -26634,17 +25182,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rnext_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rnext_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5rnext___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2749
  *     property rnext:
  *         """the :term:`reference` id of the mate """
@@ -26653,7 +25190,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rnext_1__get__(PyObject *__p
  *     property mpos:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -26661,10 +25199,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2749);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26683,17 +25221,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_5rnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_5rnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5rnext_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mtid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2750
  *         """the :term:`reference` id of the mate """
  *         def __get__(self): return self._delegate.core.mtid
@@ -26702,7 +25229,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_5rnext_3__set__(PyObject *__pyx_v_s
  *         """the position of the mate
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid) {
+static int __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -26710,10 +25238,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx_obj_9c
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2750);
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.mtid = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -26726,17 +25254,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mpos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mpos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mpos___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2754
  *         """the position of the mate
  *         deprecated, use PNEXT instead."""
@@ -26745,7 +25262,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mpos_1__get__(PyObject *__py
  *     property pnext:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -26753,10 +25271,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2754);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26775,17 +25293,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_4mpos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_4mpos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mpos_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mpos));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2755
  *         deprecated, use PNEXT instead."""
  *         def __get__(self): return self._delegate.core.mpos
@@ -26794,7 +25301,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_4mpos_3__set__(PyObject *__pyx_v_se
  *         """the position of the mate"""
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos) {
+static int __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -26802,10 +25310,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2755);
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.mpos = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -26818,17 +25326,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5pnext_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5pnext_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5pnext___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2758
  *     property pnext:
  *         """the position of the mate"""
@@ -26837,7 +25334,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5pnext_1__get__(PyObject *__p
  *     property isize:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -26845,10 +25343,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2758);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26867,17 +25365,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_5pnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_5pnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5pnext_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mpos));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2759
  *         """the position of the mate"""
  *         def __get__(self): return self._delegate.core.mpos
@@ -26886,7 +25373,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_5pnext_3__set__(PyObject *__pyx_v_s
  *         """the insert size
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos) {
+static int __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -26894,10 +25382,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx_obj_9c
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2759);
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.mpos = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -26910,17 +25398,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5isize_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_5isize_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5isize___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2763
  *         """the insert size
  *         deprecated: use tlen instead"""
@@ -26929,7 +25406,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_5isize_1__get__(PyObject *__p
  *     property tlen:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -26937,10 +25415,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2763);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -26959,17 +25437,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_5isize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_5isize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5isize_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_isize));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2764
  *         deprecated: use tlen instead"""
  *         def __get__(self): return self._delegate.core.isize
@@ -26978,7 +25445,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_5isize_3__set__(PyObject *__pyx_v_s
  *         """the insert size"""
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize) {
+static int __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -26986,10 +25454,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx_obj_9c
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2764);
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.isize = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27002,17 +25470,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tlen_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tlen_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4tlen___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2767
  *     property tlen:
  *         """the insert size"""
@@ -27021,7 +25478,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tlen_1__get__(PyObject *__py
  *     property is_paired:
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27029,10 +25487,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2767);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -27051,17 +25509,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_4tlen_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_4tlen_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4tlen_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_isize));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2768
  *         """the insert size"""
  *         def __get__(self): return self._delegate.core.isize
@@ -27070,7 +25517,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_4tlen_3__set__(PyObject *__pyx_v_se
  *         """true if read is paired in sequencing"""
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize) {
+static int __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int32_t __pyx_t_1;
@@ -27078,10 +25526,10 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2768);
   __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->_delegate->core.isize = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27094,17 +25542,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_paired_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_paired_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2771
  *     property is_paired:
  *         """true if read is paired in sequencing"""
@@ -27113,7 +25550,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_paired_1__get__(PyObject
  *             if val: self._delegate.core.flag |= BAM_FPAIRED
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27121,10 +25559,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(struct __p
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2771);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyBool_FromLong(((__pyx_v_self->_delegate->core.flag & 1) != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBool_FromLong(((((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & 1) != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -27143,17 +25581,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(struct __p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_9is_paired_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_9is_paired_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2772
  *         """true if read is paired in sequencing"""
  *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
@@ -27162,7 +25589,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_9is_paired_3__set__(PyObject *__pyx
  *             else: self._delegate.core.flag &= ~BAM_FPAIRED
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -27170,7 +25598,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2772);
 
   /* "csamtools.pyx":2773
@@ -27182,8 +25610,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_ob
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 1);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 1);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -27194,9 +25622,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_ob
  *     property is_proper_pair:
  *         """true if read is mapped in a proper pair"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~1));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~1));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27209,17 +25637,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2777
  *     property is_proper_pair:
  *         """true if read is mapped in a proper pair"""
@@ -27228,7 +25645,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_1__get__(PyO
  *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27237,10 +25655,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(stru
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2777);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -27266,17 +25684,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(stru
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2778
  *         """true if read is mapped in a proper pair"""
  *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
@@ -27285,7 +25692,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_3__set__(PyObject
  *             else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -27293,7 +25701,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2778);
 
   /* "csamtools.pyx":2779
@@ -27305,8 +25713,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 2);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 2);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -27317,9 +25725,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __
  *     property is_unmapped:
  *         """true if read itself is unmapped"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~2));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~2));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27332,17 +25740,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_11is_unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_11is_unmapped_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2783
  *     property is_unmapped:
  *         """true if read itself is unmapped"""
@@ -27351,7 +25748,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_11is_unmapped_1__get__(PyObje
  *             if val: self._delegate.core.flag |= BAM_FUNMAP
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27360,10 +25758,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(struct
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2783);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -27389,17 +25787,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2784
  *         """true if read itself is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FUNMAP) != 0
@@ -27408,7 +25795,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_3__set__(PyObject *__
  *             else: self._delegate.core.flag &= ~BAM_FUNMAP
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -27416,7 +25804,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2784);
 
   /* "csamtools.pyx":2785
@@ -27428,8 +25816,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 4);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 4);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -27440,9 +25828,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx
  *     property mate_is_unmapped:
  *         """true if the mate is unmapped"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~4));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~4));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27455,17 +25843,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2789
  *     property mate_is_unmapped:
  *         """true if the mate is unmapped"""
@@ -27474,7 +25851,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(P
  *             if val: self._delegate.core.flag |= BAM_FMUNMAP
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27483,10 +25861,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(st
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2789);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -27512,17 +25890,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(st
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2790
  *         """true if the mate is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
@@ -27531,7 +25898,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(PyObjec
  *             else: self._delegate.core.flag &= ~BAM_FMUNMAP
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -27539,7 +25907,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2790);
 
   /* "csamtools.pyx":2791
@@ -27551,8 +25919,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 8);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 8);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -27563,9 +25931,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct
  *     property is_reverse:
  *         """true if read is mapped to reverse strand"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~8));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~8));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27578,17 +25946,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_10is_reverse_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_10is_reverse_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2795
  *     property is_reverse:
  *         """true if read is mapped to reverse strand"""
@@ -27597,7 +25954,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_10is_reverse_1__get__(PyObjec
  *             if val: self._delegate.core.flag |= BAM_FREVERSE
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27606,10 +25964,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(struct _
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2795);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -27635,17 +25993,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_10is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_10is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2796
  *         """true if read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FREVERSE) != 0
@@ -27654,7 +26001,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_10is_reverse_3__set__(PyObject *__p
  *             else: self._delegate.core.flag &= ~BAM_FREVERSE
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -27662,7 +26010,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2796);
 
   /* "csamtools.pyx":2797
@@ -27674,8 +26022,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 16);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 16);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -27686,9 +26034,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_
  *     property mate_is_reverse:
  *         """true is read is mapped to reverse strand"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~16));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~16));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27701,17 +26049,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2801
  *     property mate_is_reverse:
  *         """true is read is mapped to reverse strand"""
@@ -27720,7 +26057,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(Py
  *             if val: self._delegate.core.flag |= BAM_FMREVERSE
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27729,10 +26067,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(str
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2801);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -27758,17 +26096,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(str
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2802
  *         """true is read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
@@ -27777,7 +26104,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(PyObject
  *             else: self._delegate.core.flag &= ~BAM_FMREVERSE
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -27785,7 +26113,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct _
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2802);
 
   /* "csamtools.pyx":2803
@@ -27797,8 +26125,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct _
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 32);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 32);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -27809,9 +26137,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct _
  *     property is_read1:
  *         """true if this is read1"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~32));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~32));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27824,17 +26152,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read1_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read1_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2807
  *     property is_read1:
  *         """true if this is read1"""
@@ -27843,7 +26160,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read1_1__get__(PyObject *
  *             if val: self._delegate.core.flag |= BAM_FREAD1
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27852,10 +26170,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(struct __py
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2807);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -27881,17 +26199,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_8is_read1_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_8is_read1_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2808
  *         """true if this is read1"""
  *         def __get__(self): return (self.flag & BAM_FREAD1) != 0
@@ -27900,7 +26207,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_8is_read1_3__set__(PyObject *__pyx_
  *             else: self._delegate.core.flag &= ~BAM_FREAD1
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -27908,7 +26216,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2808);
 
   /* "csamtools.pyx":2809
@@ -27920,8 +26228,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 64);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 64);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -27932,9 +26240,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj
  *     property is_read2:
  *         """true if this is read2"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~64));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~64));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -27947,17 +26255,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read2_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read2_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2813
  *     property is_read2:
  *         """true if this is read2"""
@@ -27966,7 +26263,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read2_1__get__(PyObject *
  *             if val: self._delegate.core.flag |= BAM_FREAD2
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -27975,10 +26273,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(struct __py
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2813);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_128); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -28004,17 +26302,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_8is_read2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_8is_read2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2814
  *         """true if this is read2"""
  *         def __get__(self): return (self.flag & BAM_FREAD2) != 0
@@ -28023,7 +26310,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_8is_read2_3__set__(PyObject *__pyx_
  *             else: self._delegate.core.flag &= ~BAM_FREAD2
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -28031,7 +26319,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2814);
 
   /* "csamtools.pyx":2815
@@ -28043,8 +26331,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 128);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 128);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -28055,9 +26343,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj
  *     property is_secondary:
  *         """true if not primary alignment"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~128));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~128));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -28070,17 +26358,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_secondary_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_secondary_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2819
  *     property is_secondary:
  *         """true if not primary alignment"""
@@ -28089,7 +26366,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_secondary_1__get__(PyObj
  *             if val: self._delegate.core.flag |= BAM_FSECONDARY
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -28098,10 +26376,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(struct
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2819);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -28127,17 +26405,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_12is_secondary_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_12is_secondary_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2820
  *         """true if not primary alignment"""
  *         def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
@@ -28146,7 +26413,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_12is_secondary_3__set__(PyObject *_
  *             else: self._delegate.core.flag &= ~BAM_FSECONDARY
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -28154,7 +26422,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __py
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2820);
 
   /* "csamtools.pyx":2821
@@ -28166,8 +26434,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __py
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 256);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 256);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -28178,9 +26446,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __py
  *     property is_qcfail:
  *         """true if QC failure"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~256));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~256));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -28193,17 +26461,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_qcfail_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_qcfail_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2825
  *     property is_qcfail:
  *         """true if QC failure"""
@@ -28212,7 +26469,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_qcfail_1__get__(PyObject
  *             if val: self._delegate.core.flag |= BAM_FQCFAIL
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -28221,10 +26479,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(struct __p
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2825);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_512); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -28250,17 +26508,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(struct __p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2826
  *         """true if QC failure"""
  *         def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
@@ -28269,7 +26516,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_3__set__(PyObject *__pyx
  *             else: self._delegate.core.flag &= ~BAM_FQCFAIL
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -28277,7 +26525,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2826);
 
   /* "csamtools.pyx":2827
@@ -28289,8 +26537,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_ob
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 512);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 512);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -28301,9 +26549,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_ob
  *     property is_duplicate:
  *         """true if optical or PCR duplicate"""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~512));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~512));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -28316,17 +26564,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_duplicate_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_duplicate_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2831
  *     property is_duplicate:
  *         """true if optical or PCR duplicate"""
@@ -28335,7 +26572,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_duplicate_1__get__(PyObj
  *             if val: self._delegate.core.flag |= BAM_FDUP
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -28344,10 +26582,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(struct
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2831);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_1024); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -28373,17 +26611,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2832
  *         """true if optical or PCR duplicate"""
  *         def __get__(self): return (self.flag & BAM_FDUP) != 0
@@ -28392,7 +26619,8 @@ static int __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_3__set__(PyObject *_
  *             else: self._delegate.core.flag &= ~BAM_FDUP
  */
 
-static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
+static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
+static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -28400,7 +26628,7 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __py
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 2832);
 
   /* "csamtools.pyx":2833
@@ -28412,8 +26640,8 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __py
  */
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 1024);
-    goto __pyx_L3;
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 1024);
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -28424,9 +26652,9 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __py
  *     property positions:
  *         """a list of reference positions that this read aligns to."""
  */
-    __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~1024));
+    ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~1024));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -28439,17 +26667,6 @@ static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_9positions_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_9positions_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9positions___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2837
  *     property positions:
  *         """a list of reference positions that this read aligns to."""
@@ -28458,7 +26675,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_9positions_1__get__(PyObject
  *             cdef int op
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *__pyx_v_self) {
   uint32_t __pyx_v_k;
   uint32_t __pyx_v_i;
   uint32_t __pyx_v_pos;
@@ -28479,7 +26697,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __p
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2837);
 
   /* "csamtools.pyx":2843
@@ -28489,7 +26707,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __p
  *             if src.core.n_cigar == 0: return []
  * 
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2844
  * 
@@ -28502,13 +26720,13 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __p
   if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2846
  *             if src.core.n_cigar == 0: return []
@@ -28518,7 +26736,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __p
  *             cigar_p = bam1_cigar(src)
  */
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_v_result = __pyx_t_2;
   __pyx_t_2 = 0;
 
@@ -28605,14 +26823,17 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __p
  * 
  *                 if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
  */
+        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_6 = PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       }
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
-    __pyx_L6:;
+    __pyx_L8:;
 
     /* "csamtools.pyx":2857
  *                         result.append( i )
@@ -28673,17 +26894,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_13aligned_pairs_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_13aligned_pairs_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2867
  *        Unaligned position are marked by None.
  *        """
@@ -28692,7 +26902,8 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_13aligned_pairs_1__get__(PyOb
  *            cdef int op
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(PyObject *__pyx_v_self) {
   uint32_t __pyx_v_k;
   uint32_t __pyx_v_i;
   uint32_t __pyx_v_pos;
@@ -28715,7 +26926,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struc
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 2867);
 
   /* "csamtools.pyx":2873
@@ -28725,7 +26936,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struc
  *            if src.core.n_cigar == 0: return []
  * 
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2874
  * 
@@ -28738,13 +26949,13 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struc
   if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2876
  *            if src.core.n_cigar == 0: return []
@@ -28754,7 +26965,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struc
  *            qpos = 0
  */
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_v_result = __pyx_t_2;
   __pyx_t_2 = 0;
 
@@ -28858,12 +27069,15 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struc
  *                        qpos += 1
  *                    pos += l
  */
+        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_qpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
         PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
         __Pyx_GIVEREF(__pyx_t_4);
         PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
@@ -28932,10 +27146,13 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struc
  *                        qpos += 1
  * 
  */
+        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_qpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
         __Pyx_INCREF(Py_None);
@@ -28989,10 +27206,13 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struc
  *                    pos += l
  * 
  */
+        if (unlikely(((PyObject *)__pyx_v_result) == Py_None)) {
+          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+        }
         __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(Py_None);
         PyTuple_SET_ITEM(__pyx_t_2, 0, Py_None);
         __Pyx_GIVEREF(Py_None);
@@ -29051,29 +27271,58 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_11overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_10overlap[] = "AlignedRead.overlap(self, uint32_t start, uint32_t end)\nreturn number of aligned bases of read overlapping the interval *start* and *end*\n        on the reference sequence.\n        ";
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_11overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":2904
+ * 
+ * 
+ *     def overlap( self, uint32_t start, uint32_t end ):             # <<<<<<<<<<<<<<
+ *         """return number of aligned bases of read overlapping the interval *start* and *end*
+ *         on the reference sequence.
+ */
+
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_5overlap[] = "AlignedRead.overlap(self, uint32_t start, uint32_t end)\nreturn number of aligned bases of read overlapping the interval *start* and *end*\n        on the reference sequence.\n        ";
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_5overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   uint32_t __pyx_v_start;
   uint32_t __pyx_v_end;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0};
-  PyObject *__pyx_r = 0;
+  uint32_t __pyx_v_k;
+  uint32_t __pyx_v_pos;
+  uint32_t __pyx_v_overlap;
+  int __pyx_v_op;
+  int __pyx_v_o;
+  uint32_t *__pyx_v_cigar_p;
+  bam1_t *__pyx_v_src;
+  PyObject *__pyx_v_l = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("overlap (wrapper)", 0);
+  int __pyx_t_1;
+  uint32_t __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  uint32_t __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  uint32_t __pyx_t_8;
+  uint32_t __pyx_t_9;
+  int __pyx_t_10;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("overlap");
+  __Pyx_TraceCall("overlap", __pyx_f[0], 2904);
   {
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
         if (likely(values[0])) kw_args--;
@@ -29086,7 +27335,7 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_11overlap(PyObject *__pyx_v_s
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "overlap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "overlap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -29105,46 +27354,6 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_11overlap(PyObject *__pyx_v_s
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_10overlap(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), __pyx_v_start, __pyx_v_end);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":2904
- * 
- * 
- *     def overlap( self, uint32_t start, uint32_t end ):             # <<<<<<<<<<<<<<
- *         """return number of aligned bases of read overlapping the interval *start* and *end*
- *         on the reference sequence.
- */
-
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, uint32_t __pyx_v_start, uint32_t __pyx_v_end) {
-  uint32_t __pyx_v_k;
-  uint32_t __pyx_v_pos;
-  uint32_t __pyx_v_overlap;
-  int __pyx_v_op;
-  int __pyx_v_o;
-  uint32_t *__pyx_v_cigar_p;
-  bam1_t *__pyx_v_src;
-  PyObject *__pyx_v_l = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  uint32_t __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  uint32_t __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  uint32_t __pyx_t_8;
-  uint32_t __pyx_t_9;
-  int __pyx_t_10;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("overlap", 0);
-  __Pyx_TraceCall("overlap", __pyx_f[0], 2904);
 
   /* "csamtools.pyx":2913
  *         cdef bam1_t * src
@@ -29162,7 +27371,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_9c
  *         if src.core.n_cigar == 0: return 0
  *         pos = src.core.pos
  */
-  __pyx_v_src = __pyx_v_self->_delegate;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
   /* "csamtools.pyx":2916
  * 
@@ -29177,9 +27386,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_9c
     __Pyx_INCREF(__pyx_int_0);
     __pyx_r = __pyx_int_0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":2917
  *         src = self._delegate
@@ -29307,12 +27516,12 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_9c
       __pyx_t_1 = (__pyx_v_o > 0);
       if (__pyx_t_1) {
         __pyx_v_overlap = (__pyx_v_overlap + __pyx_v_o);
-        goto __pyx_L7;
+        goto __pyx_L10;
       }
-      __pyx_L7:;
-      goto __pyx_L6;
+      __pyx_L10:;
+      goto __pyx_L9;
     }
-    __pyx_L6:;
+    __pyx_L9:;
 
     /* "csamtools.pyx":2929
  *                 if o > 0: overlap += o
@@ -29376,18 +27585,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_9c
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_13opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_12opt[] = "AlignedRead.opt(self, tag)\nretrieves optional data given a two-letter *tag*";
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_13opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("opt (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12opt(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tag));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2934
  *         return overlap
  * 
@@ -29396,12 +27593,14 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_13opt(PyObject *__pyx_v_self,
  *         #see bam_aux.c: bam_aux_get() and bam_aux2i() etc
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tag) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_6opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_6opt[] = "AlignedRead.opt(self, tag)\nretrieves optional data given a two-letter *tag*";
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_6opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
   uint8_t *__pyx_v_v;
-  CYTHON_UNUSED int __pyx_v_nvalues;
+  int __pyx_v_nvalues;
   PyObject *__pyx_v_btag = NULL;
   PyObject *__pyx_v_auxtype = NULL;
-  CYTHON_UNUSED PyObject *__pyx_v_bytesize = NULL;
+  PyObject *__pyx_v_bytesize = NULL;
   PyObject *__pyx_v_values = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -29422,7 +27621,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("opt", 0);
+  __Pyx_RefNannySetupContext("opt");
   __Pyx_TraceCall("opt", __pyx_f[0], 2934);
 
   /* "csamtools.pyx":2939
@@ -29445,7 +27644,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
  *         auxtype = chr(v[0])
  */
   __pyx_t_2 = PyBytes_AsString(((PyObject *)__pyx_v_btag)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_v = bam_aux_get(__pyx_v_self->_delegate, __pyx_t_2);
+  __pyx_v_v = bam_aux_get(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate, __pyx_t_2);
 
   /* "csamtools.pyx":2941
  *         btag = _force_bytes(tag)
@@ -29459,7 +27658,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_148), __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
     __pyx_t_1 = 0;
@@ -29469,9 +27668,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":2942
  *         v = bam_aux_get(self._delegate, btag)
@@ -29483,7 +27682,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
   __pyx_t_1 = __Pyx_PyInt_to_py_uint8_t((__pyx_v_v[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
@@ -29534,7 +27733,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
   /* "csamtools.pyx":2945
@@ -29566,7 +27765,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
   /* "csamtools.pyx":2947
@@ -29598,7 +27797,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
   /* "csamtools.pyx":2949
@@ -29630,7 +27829,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
   /* "csamtools.pyx":2951
@@ -29659,7 +27858,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __pyx_r = ((PyObject *)__pyx_t_4);
     __pyx_t_4 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
   /* "csamtools.pyx":2955
@@ -29685,7 +27884,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __pyx_r = __pyx_t_4;
     __pyx_t_4 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
   /* "csamtools.pyx":2957
@@ -29738,21 +27937,21 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
       __Pyx_GOTREF(__pyx_t_11);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
-      index = 0; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
+      index = 0; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_1);
-      index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
+      index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_9);
-      index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L5_unpacking_failed;
+      index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_10);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      goto __pyx_L6_unpacking_done;
-      __pyx_L5_unpacking_failed:;
+      goto __pyx_L8_unpacking_done;
+      __pyx_L7_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
       if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
       if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_L6_unpacking_done:;
+      __pyx_L8_unpacking_done:;
     }
     __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
@@ -29773,7 +27972,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __Pyx_INCREF(__pyx_v_values);
     __pyx_r = __pyx_v_values;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
   /*else*/ {
 
@@ -29787,7 +27986,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_149), __pyx_v_auxtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
     PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_4));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
     __pyx_t_4 = 0;
@@ -29798,7 +27997,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -29821,18 +28020,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamt
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_15fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_11AlignedRead_14fancy_str[] = "AlignedRead.fancy_str(self)\nreturns list of fieldnames/values in pretty format for debugging\n        ";
-static PyObject *__pyx_pw_9csamtools_11AlignedRead_15fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("fancy_str (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11AlignedRead_14fancy_str(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":2964
  * 
  * 
@@ -29841,7 +28028,9 @@ static PyObject *__pyx_pw_9csamtools_11AlignedRead_15fancy_str(PyObject *__pyx_v
  *         """
  */
 
-static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_7fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_11AlignedRead_7fancy_str[] = "AlignedRead.fancy_str(self)\nreturns list of fieldnames/values in pretty format for debugging\n        ";
+static PyObject *__pyx_pf_9csamtools_11AlignedRead_7fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   PyObject *__pyx_v_ret_string = NULL;
   PyObject *__pyx_v_field_names = NULL;
   PyObject *__pyx_v_fields_names_in_order = NULL;
@@ -29863,7 +28052,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("fancy_str", 0);
+  __Pyx_RefNannySetupContext("fancy_str");
   __Pyx_TraceCall("fancy_str", __pyx_f[0], 2964);
 
   /* "csamtools.pyx":2967
@@ -29874,7 +28063,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  *            "tid":           "Contig index",
  */
   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_v_ret_string = __pyx_t_1;
   __pyx_t_1 = 0;
 
@@ -29916,7 +28105,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  *                                  "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"]
  */
   __pyx_t_1 = PyList_New(18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__tid));
   PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tid));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tid));
@@ -29981,6 +28170,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  *             if not f in self.__dict__:
  *                 continue
  */
+  if (unlikely(((PyObject *)__pyx_v_fields_names_in_order) == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
   __pyx_t_1 = ((PyObject *)__pyx_v_fields_names_in_order); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
   for (;;) {
     if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
@@ -29996,7 +28188,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  *                 continue
  *             ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
  */
-    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____dict__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_v_f))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -30010,10 +28202,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  *             ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
  * 
  */
-      goto __pyx_L3_continue;
-      goto __pyx_L5;
+      goto __pyx_L5_continue;
+      goto __pyx_L7;
     }
-    __pyx_L5:;
+    __pyx_L7:;
 
     /* "csamtools.pyx":2995
  *             if not f in self.__dict__:
@@ -30022,6 +28214,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  * 
  *         for f in self.__dict__:
  */
+    if (unlikely(((PyObject *)__pyx_v_ret_string) == Py_None)) {
+      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
     __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_field_names), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_kp_s_169), __pyx_v_f); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -30029,10 +28224,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
     __pyx_t_7 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_170)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     __Pyx_INCREF(__pyx_v_f);
     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
     __Pyx_GIVEREF(__pyx_v_f);
@@ -30041,7 +28236,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
     __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
@@ -30056,7 +28251,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
     __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
     __pyx_t_10 = PyList_Append(__pyx_v_ret_string, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-    __pyx_L3_continue:;
+    __pyx_L5_continue:;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
@@ -30067,7 +28262,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  *             if not f in field_names:
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
     __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); __pyx_t_2 = 0;
@@ -30079,10 +28274,10 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   for (;;) {
-    if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_9)) {
+    if (PyList_CheckExact(__pyx_t_9)) {
       if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_9)) break;
       __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
-    } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_9)) {
+    } else if (PyTuple_CheckExact(__pyx_t_9)) {
       if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
       __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
     } else {
@@ -30107,6 +28302,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
  *         return ret_string
  */
+    if (unlikely(((PyObject *)__pyx_v_field_names) == Py_None)) {
+      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
     __pyx_t_5 = ((PyDict_Contains(((PyObject *)__pyx_v_field_names), __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = (!__pyx_t_5);
     if (__pyx_t_4) {
@@ -30118,10 +28316,13 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
  *         return ret_string
  * 
  */
-      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(((PyObject *)__pyx_v_ret_string) == Py_None)) {
+        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+      }
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_INCREF(__pyx_v_f);
       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
@@ -30130,7 +28331,7 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
       __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_INCREF(__pyx_v_f);
       PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
@@ -30145,9 +28346,9 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
       __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
       __pyx_t_10 = PyList_Append(__pyx_v_ret_string, ((PyObject *)__pyx_t_7)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-      goto __pyx_L8;
+      goto __pyx_L10;
     }
-    __pyx_L8:;
+    __pyx_L10:;
   }
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
@@ -30185,20 +28386,6 @@ static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11PileupProxy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_11PileupProxy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
-    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
-  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
-  __pyx_r = __pyx_pf_9csamtools_11PileupProxy___init__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3019
  *     will change.
  *     '''
@@ -30207,7 +28394,8 @@ static int __pyx_pw_9csamtools_11PileupProxy_1__init__(PyObject *__pyx_v_self, P
  * 
  */
 
-static int __pyx_pf_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
+static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -30215,8 +28403,11 @@ static int __pyx_pf_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struct __pyx
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__init__", 0);
+  __Pyx_RefNannySetupContext("__init__");
   __Pyx_TraceCall("__init__", __pyx_f[0], 3019);
+  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
 
   /* "csamtools.pyx":3020
  *     '''
@@ -30243,17 +28434,6 @@ static int __pyx_pf_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_3__str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_3__str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11PileupProxy_2__str__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3022
  *         raise TypeError("This class cannot be instantiated from Python")
  * 
@@ -30262,7 +28442,8 @@ static PyObject *__pyx_pw_9csamtools_11PileupProxy_3__str__(PyObject *__pyx_v_se
  *             "\n" +\
  */
 
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_1__str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_1__str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -30274,7 +28455,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9cs
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__str__", 0);
+  __Pyx_RefNannySetupContext("__str__");
   __Pyx_TraceCall("__str__", __pyx_f[0], 3022);
 
   /* "csamtools.pyx":3023
@@ -30303,14 +28484,14 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9cs
  *             "\n" +\
  *             "\n".join( map(str, self.pileups) )
  */
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_self->pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
@@ -30321,7 +28502,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9cs
   __pyx_t_3 = 0;
   __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
@@ -30332,7 +28513,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9cs
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_5 = 0;
@@ -30353,10 +28534,10 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9cs
  */
   __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_6), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
@@ -30367,7 +28548,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9cs
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
@@ -30400,17 +28581,6 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9cs
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_3tid_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11PileupProxy_3tid___get__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3029
  *     property tid:
  *         '''the chromosome ID as is defined in the header'''
@@ -30419,7 +28589,8 @@ static PyObject *__pyx_pw_9csamtools_11PileupProxy_3tid_1__get__(PyObject *__pyx
  *     property n:
  */
 
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -30427,10 +28598,10 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3029);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -30449,17 +28620,6 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_1n_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_1n_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11PileupProxy_1n___get__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3033
  *     property n:
  *         '''number of reads mapping to this column.'''
@@ -30468,7 +28628,8 @@ static PyObject *__pyx_pw_9csamtools_11PileupProxy_1n_1__get__(PyObject *__pyx_v
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -30476,10 +28637,10 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(struct __pyx_obj_9
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3033);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->n_pu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -30498,17 +28659,6 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(struct __pyx_obj_9
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_11PileupProxy_1n_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
-static int __pyx_pw_9csamtools_11PileupProxy_1n_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11PileupProxy_1n_2__set__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self), ((PyObject *)__pyx_v_n));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3034
  *         '''number of reads mapping to this column.'''
  *         def __get__(self): return self.n_pu
@@ -30517,7 +28667,8 @@ static int __pyx_pw_9csamtools_11PileupProxy_1n_3__set__(PyObject *__pyx_v_self,
  *     property pos:
  */
 
-static int __pyx_pf_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self, PyObject *__pyx_v_n) {
+static int __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
+static int __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -30525,10 +28676,10 @@ static int __pyx_pf_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj_9csamt
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__set__", 0);
+  __Pyx_RefNannySetupContext("__set__");
   __Pyx_TraceCall("__set__", __pyx_f[0], 3034);
   __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_n); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->n_pu = __pyx_t_1;
+  ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -30541,17 +28692,6 @@ static int __pyx_pf_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj_9csamt
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_3pos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11PileupProxy_3pos___get__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3037
  * 
  *     property pos:
@@ -30560,7 +28700,8 @@ static PyObject *__pyx_pw_9csamtools_11PileupProxy_3pos_1__get__(PyObject *__pyx
  *     property pileups:
  */
 
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -30568,10 +28709,10 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3037);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -30590,17 +28731,6 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_7pileups_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_11PileupProxy_7pileups_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_11PileupProxy_7pileups___get__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3041
  *     property pileups:
  *         '''list of reads (:class:`pysam.PileupRead`) aligned to this column'''
@@ -30609,7 +28739,8 @@ static PyObject *__pyx_pw_9csamtools_11PileupProxy_7pileups_1__get__(PyObject *_
  *             pileups = []
  */
 
-static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__pyx_v_self) {
   int __pyx_v_x;
   PyObject *__pyx_v_pileups = NULL;
   PyObject *__pyx_r = NULL;
@@ -30622,7 +28753,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3041);
 
   /* "csamtools.pyx":3043
@@ -30633,7 +28764,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx
  *             if self.plp[0] == NULL:
  */
   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_v_pileups = __pyx_t_1;
   __pyx_t_1 = 0;
 
@@ -30644,7 +28775,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx
  *                 raise ValueError("PileupProxy accessed after iterator finished")
  * 
  */
-  __pyx_t_2 = ((__pyx_v_self->plp[0]) == NULL);
+  __pyx_t_2 = ((((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->plp[0]) == NULL);
   if (__pyx_t_2) {
 
     /* "csamtools.pyx":3046
@@ -30659,9 +28790,9 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx
     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   /* "csamtools.pyx":3050
  *             # warning: there could be problems if self.n and self.buf are
@@ -30670,7 +28801,7 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx
  *                 pileups.append( makePileupRead( &(self.plp[0][x])) )
  *             return pileups
  */
-  __pyx_t_3 = __pyx_v_self->n_pu;
+  __pyx_t_3 = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
     /* "csamtools.pyx":3051
@@ -30680,7 +28811,10 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx
  *             return pileups
  * 
  */
-    __pyx_t_1 = __pyx_f_9csamtools_makePileupRead((&((__pyx_v_self->plp[0])[__pyx_v_x]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(((PyObject *)__pyx_v_pileups) == Py_None)) {
+      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+    }
+    __pyx_t_1 = __pyx_f_9csamtools_makePileupRead((&((((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->plp[0])[__pyx_v_x]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_4 = PyList_Append(__pyx_v_pileups, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -30712,20 +28846,6 @@ static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_10PileupRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_10PileupRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
-    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
-  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead___init__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3058
  *     '''
  * 
@@ -30734,7 +28854,8 @@ static int __pyx_pw_9csamtools_10PileupRead_1__init__(PyObject *__pyx_v_self, Py
  * 
  */
 
-static int __pyx_pf_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -30742,8 +28863,11 @@ static int __pyx_pf_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct __pyx_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__init__", 0);
+  __Pyx_RefNannySetupContext("__init__");
   __Pyx_TraceCall("__init__", __pyx_f[0], 3058);
+  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
 
   /* "csamtools.pyx":3059
  * 
@@ -30770,17 +28894,6 @@ static int __pyx_pf_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_10PileupRead_3__str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_10PileupRead_3__str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead_2__str__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3061
  *         raise TypeError("This class cannot be instantiated from Python")
  * 
@@ -30789,7 +28902,8 @@ static PyObject *__pyx_pw_9csamtools_10PileupRead_3__str__(PyObject *__pyx_v_sel
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_1__str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_1__str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -30805,7 +28919,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__str__", 0);
+  __Pyx_RefNannySetupContext("__str__");
   __Pyx_TraceCall("__str__", __pyx_f[0], 3061);
 
   /* "csamtools.pyx":3062
@@ -30818,22 +28932,22 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csa
   __Pyx_XDECREF(__pyx_r);
   __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__alignment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__alignment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__qpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__indel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__indel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__is_del); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_del); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__is_head); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_head); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__is_tail); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_tail); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
   PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
@@ -30856,7 +28970,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csa
   __pyx_t_7 = 0;
   __pyx_t_8 = 0;
   __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
   __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
@@ -30867,7 +28981,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csa
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
   __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
   PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
   __Pyx_GIVEREF(__pyx_t_9);
   __pyx_t_9 = 0;
@@ -30900,17 +29014,6 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_10PileupRead_9alignment_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_10PileupRead_9alignment_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead_9alignment___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3066
  *     property alignment:
  *         """a :class:`pysam.AlignedRead` object of the aligned read"""
@@ -30919,11 +29022,12 @@ static PyObject *__pyx_pw_9csamtools_10PileupRead_9alignment_1__get__(PyObject *
  *     property qpos:
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3066);
 
   /* "csamtools.pyx":3067
@@ -30934,8 +29038,8 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(struct __py
  *         """position of the read base at the pileup site, 0-based"""
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->_alignment));
-  __pyx_r = ((PyObject *)__pyx_v_self->_alignment);
+  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_alignment));
+  __pyx_r = ((PyObject *)((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_alignment);
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -30946,17 +29050,6 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_10PileupRead_4qpos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_10PileupRead_4qpos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead_4qpos___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3070
  *     property qpos:
  *         """position of the read base at the pileup site, 0-based"""
@@ -30965,7 +29058,8 @@ static PyObject *__pyx_pw_9csamtools_10PileupRead_4qpos_1__get__(PyObject *__pyx
  *     property indel:
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -30973,7 +29067,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3070);
 
   /* "csamtools.pyx":3071
@@ -30984,7 +29078,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj
  *         """indel length; 0 for no indel, positive for ins and negative for del"""
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_qpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_qpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -31003,17 +29097,6 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_10PileupRead_5indel_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_10PileupRead_5indel_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead_5indel___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3074
  *     property indel:
  *         """indel length; 0 for no indel, positive for ins and negative for del"""
@@ -31022,7 +29105,8 @@ static PyObject *__pyx_pw_9csamtools_10PileupRead_5indel_1__get__(PyObject *__py
  *     property is_del:
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -31030,7 +29114,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3074);
 
   /* "csamtools.pyx":3075
@@ -31041,7 +29125,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(struct __pyx_ob
  *         """1 iff the base on the padded read is a deletion"""
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_indel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_indel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -31060,17 +29144,6 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_10PileupRead_6is_del_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_10PileupRead_6is_del_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead_6is_del___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3078
  *     property is_del:
  *         """1 iff the base on the padded read is a deletion"""
@@ -31079,7 +29152,8 @@ static PyObject *__pyx_pw_9csamtools_10PileupRead_6is_del_1__get__(PyObject *__p
  *     property is_head:
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -31087,7 +29161,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(struct __pyx_o
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3078);
 
   /* "csamtools.pyx":3079
@@ -31098,7 +29172,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(struct __pyx_o
  *         def __get__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_is_del); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_del); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -31117,17 +29191,6 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_head_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_head_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead_7is_head___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3081
  *             return self._is_del
  *     property is_head:
@@ -31136,7 +29199,8 @@ static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_head_1__get__(PyObject *__
  *     property is_tail:
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -31144,7 +29208,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(struct __pyx_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3081);
 
   /* "csamtools.pyx":3082
@@ -31155,7 +29219,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(struct __pyx_
  *         def __get__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_is_head); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_head); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -31174,17 +29238,6 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_tail_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_tail_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead_7is_tail___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3084
  *             return self._is_head
  *     property is_tail:
@@ -31193,7 +29246,8 @@ static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_tail_1__get__(PyObject *__
  *     property level:
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -31201,7 +29255,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3084);
 
   /* "csamtools.pyx":3085
@@ -31212,7 +29266,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_
  *         def __get__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_is_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -31231,17 +29285,6 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_10PileupRead_5level_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_10PileupRead_5level_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_10PileupRead_5level___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3087
  *             return self._is_tail
  *     property level:
@@ -31250,7 +29293,8 @@ static PyObject *__pyx_pw_9csamtools_10PileupRead_5level_1__get__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -31258,7 +29302,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(struct __pyx_ob
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3087);
 
   /* "csamtools.pyx":3088
@@ -31269,7 +29313,7 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(struct __pyx_ob
  * class Outs:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -31288,32 +29332,44 @@ static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_4Outs_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+/* "csamtools.pyx":3092
+ * class Outs:
+ *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
+ *     def __init__(self, id = 1):             # <<<<<<<<<<<<<<
+ *         self.streams = []
+ *         self.id = id
+ */
+
+static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_9csamtools_4Outs___init__[] = "Outs.__init__(self, id=1)";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_9csamtools_4Outs_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs___init__)};
-static PyObject *__pyx_pw_9csamtools_4Outs_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyMethodDef __pyx_mdef_9csamtools_4Outs___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_4Outs___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs___init__)};
+static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_id = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__id,0};
-  PyObject *__pyx_r = 0;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__id,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__init__");
+  __Pyx_TraceCall("__init__", __pyx_f[0], 3092);
   __pyx_self = __pyx_self;
   {
     PyObject* values[2] = {0,0};
-    values[1] = ((PyObject *)((PyObject *)__pyx_int_1));
+    values[1] = ((PyObject *)__pyx_int_1);
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
         if (likely(values[0])) kw_args--;
@@ -31325,7 +29381,7 @@ static PyObject *__pyx_pw_9csamtools_4Outs_1__init__(PyObject *__pyx_self, PyObj
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -31346,29 +29402,6 @@ static PyObject *__pyx_pw_9csamtools_4Outs_1__init__(PyObject *__pyx_self, PyObj
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_4Outs___init__(__pyx_self, __pyx_v_self, __pyx_v_id);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":3092
- * class Outs:
- *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
- *     def __init__(self, id = 1):             # <<<<<<<<<<<<<<
- *         self.streams = []
- *         self.id = id
- */
-
-static PyObject *__pyx_pf_9csamtools_4Outs___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_id) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__init__", 0);
-  __Pyx_TraceCall("__init__", __pyx_f[0], 3092);
 
   /* "csamtools.pyx":3093
  *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
@@ -31378,7 +29411,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs___init__(CYTHON_UNUSED PyObject *__py
  * 
  */
   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__streams, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
@@ -31404,31 +29437,46 @@ static PyObject *__pyx_pf_9csamtools_4Outs___init__(CYTHON_UNUSED PyObject *__py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_4Outs_3setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_4Outs_2setdevice[] = "Outs.setdevice(self, filename)\nopen an existing file, like \"/dev/null\"";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_3setdevice = {__Pyx_NAMESTR("setdevice"), (PyCFunction)__pyx_pw_9csamtools_4Outs_3setdevice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_2setdevice)};
-static PyObject *__pyx_pw_9csamtools_4Outs_3setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":3096
+ *         self.id = id
+ * 
+ *     def setdevice(self, filename):             # <<<<<<<<<<<<<<
+ *         '''open an existing file, like "/dev/null"'''
+ *         fd = os.open(filename, os.O_WRONLY)
+ */
+
+static PyObject *__pyx_pf_9csamtools_4Outs_1setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_4Outs_1setdevice[] = "Outs.setdevice(self, filename)\nopen an existing file, like \"/dev/null\"";
+static PyMethodDef __pyx_mdef_9csamtools_4Outs_1setdevice = {__Pyx_NAMESTR("setdevice"), (PyCFunction)__pyx_pf_9csamtools_4Outs_1setdevice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_1setdevice)};
+static PyObject *__pyx_pf_9csamtools_4Outs_1setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filename = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
-  PyObject *__pyx_r = 0;
+  PyObject *__pyx_v_fd = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("setdevice (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("setdevice");
+  __Pyx_TraceCall("setdevice", __pyx_f[0], 3096);
   __pyx_self = __pyx_self;
   {
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
         if (likely(values[0])) kw_args--;
@@ -31441,7 +29489,7 @@ static PyObject *__pyx_pw_9csamtools_4Outs_3setdevice(PyObject *__pyx_self, PyOb
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setdevice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setdevice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -31460,32 +29508,6 @@ static PyObject *__pyx_pw_9csamtools_4Outs_3setdevice(PyObject *__pyx_self, PyOb
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_4Outs_2setdevice(__pyx_self, __pyx_v_self, __pyx_v_filename);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":3096
- *         self.id = id
- * 
- *     def setdevice(self, filename):             # <<<<<<<<<<<<<<
- *         '''open an existing file, like "/dev/null"'''
- *         fd = os.open(filename, os.O_WRONLY)
- */
-
-static PyObject *__pyx_pf_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
-  PyObject *__pyx_v_fd = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("setdevice", 0);
-  __Pyx_TraceCall("setdevice", __pyx_f[0], 3096);
 
   /* "csamtools.pyx":3098
  *     def setdevice(self, filename):
@@ -31505,7 +29527,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObject *__
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_filename);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
   __Pyx_GIVEREF(__pyx_v_filename);
@@ -31529,7 +29551,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObject *__
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fd);
   __Pyx_GIVEREF(__pyx_v_fd);
@@ -31555,31 +29577,47 @@ static PyObject *__pyx_pf_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObject *__
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_4Outs_5setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_4Outs_4setfile[] = "Outs.setfile(self, filename)\nopen a new file.";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_5setfile = {__Pyx_NAMESTR("setfile"), (PyCFunction)__pyx_pw_9csamtools_4Outs_5setfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_4setfile)};
-static PyObject *__pyx_pw_9csamtools_4Outs_5setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":3101
+ *         self.setfd(fd)
+ * 
+ *     def setfile(self, filename):             # <<<<<<<<<<<<<<
+ *         '''open a new file.'''
+ *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
+ */
+
+static PyObject *__pyx_pf_9csamtools_4Outs_2setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_4Outs_2setfile[] = "Outs.setfile(self, filename)\nopen a new file.";
+static PyMethodDef __pyx_mdef_9csamtools_4Outs_2setfile = {__Pyx_NAMESTR("setfile"), (PyCFunction)__pyx_pf_9csamtools_4Outs_2setfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_2setfile)};
+static PyObject *__pyx_pf_9csamtools_4Outs_2setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filename = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
-  PyObject *__pyx_r = 0;
+  PyObject *__pyx_v_fd = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("setfile (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("setfile");
+  __Pyx_TraceCall("setfile", __pyx_f[0], 3101);
   __pyx_self = __pyx_self;
   {
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
         if (likely(values[0])) kw_args--;
@@ -31592,7 +29630,7 @@ static PyObject *__pyx_pw_9csamtools_4Outs_5setfile(PyObject *__pyx_self, PyObje
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setfile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -31611,33 +29649,6 @@ static PyObject *__pyx_pw_9csamtools_4Outs_5setfile(PyObject *__pyx_self, PyObje
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_4Outs_4setfile(__pyx_self, __pyx_v_self, __pyx_v_filename);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":3101
- *         self.setfd(fd)
- * 
- *     def setfile(self, filename):             # <<<<<<<<<<<<<<
- *         '''open a new file.'''
- *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
- */
-
-static PyObject *__pyx_pf_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
-  PyObject *__pyx_v_fd = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("setfile", 0);
-  __Pyx_TraceCall("setfile", __pyx_f[0], 3101);
 
   /* "csamtools.pyx":3103
  *     def setfile(self, filename):
@@ -31666,7 +29677,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObject *__py
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(__pyx_v_filename);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
   __Pyx_GIVEREF(__pyx_v_filename);
@@ -31693,7 +29704,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObject *__py
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_INCREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fd);
   __Pyx_GIVEREF(__pyx_v_fd);
@@ -31720,31 +29731,46 @@ static PyObject *__pyx_pf_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObject *__py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_4Outs_7setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9csamtools_4Outs_6setfd[] = "Outs.setfd(self, fd)";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_7setfd = {__Pyx_NAMESTR("setfd"), (PyCFunction)__pyx_pw_9csamtools_4Outs_7setfd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_6setfd)};
-static PyObject *__pyx_pw_9csamtools_4Outs_7setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":3106
+ *         self.setfd(fd)
+ * 
+ *     def setfd(self, fd):             # <<<<<<<<<<<<<<
+ *         ofd = os.dup(self.id)      #  Save old stream on new unit.
+ *         self.streams.append(ofd)
+ */
+
+static PyObject *__pyx_pf_9csamtools_4Outs_3setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_9csamtools_4Outs_3setfd[] = "Outs.setfd(self, fd)";
+static PyMethodDef __pyx_mdef_9csamtools_4Outs_3setfd = {__Pyx_NAMESTR("setfd"), (PyCFunction)__pyx_pf_9csamtools_4Outs_3setfd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_3setfd)};
+static PyObject *__pyx_pf_9csamtools_4Outs_3setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_fd = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fd,0};
-  PyObject *__pyx_r = 0;
+  PyObject *__pyx_v_ofd = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("setfd (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fd,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("setfd");
+  __Pyx_TraceCall("setfd", __pyx_f[0], 3106);
   __pyx_self = __pyx_self;
   {
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
         if (likely(values[0])) kw_args--;
@@ -31757,7 +29783,7 @@ static PyObject *__pyx_pw_9csamtools_4Outs_7setfd(PyObject *__pyx_self, PyObject
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setfd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -31776,32 +29802,6 @@ static PyObject *__pyx_pw_9csamtools_4Outs_7setfd(PyObject *__pyx_self, PyObject
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools_4Outs_6setfd(__pyx_self, __pyx_v_self, __pyx_v_fd);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":3106
- *         self.setfd(fd)
- * 
- *     def setfd(self, fd):             # <<<<<<<<<<<<<<
- *         ofd = os.dup(self.id)      #  Save old stream on new unit.
- *         self.streams.append(ofd)
- */
-
-static PyObject *__pyx_pf_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fd) {
-  PyObject *__pyx_v_ofd = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("setfd", 0);
-  __Pyx_TraceCall("setfd", __pyx_f[0], 3106);
 
   /* "csamtools.pyx":3107
  * 
@@ -31818,7 +29818,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
@@ -31898,7 +29898,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fd);
   __Pyx_GIVEREF(__pyx_v_fd);
@@ -31924,7 +29924,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_INCREF(__pyx_v_fd);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fd);
   __Pyx_GIVEREF(__pyx_v_fd);
@@ -31950,20 +29950,6 @@ static PyObject *__pyx_pf_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_4Outs_9restore(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_9csamtools_4Outs_8restore[] = "Outs.restore(self)\nrestore previous output stream";
-static PyMethodDef __pyx_mdef_9csamtools_4Outs_9restore = {__Pyx_NAMESTR("restore"), (PyCFunction)__pyx_pw_9csamtools_4Outs_9restore, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_8restore)};
-static PyObject *__pyx_pw_9csamtools_4Outs_9restore(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("restore (wrapper)", 0);
-  __pyx_self = __pyx_self;
-  __pyx_r = __pyx_pf_9csamtools_4Outs_8restore(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3114
  *         os.close(fd)                #  Close other unit (look out, caller.)
  * 
@@ -31972,7 +29958,10 @@ static PyObject *__pyx_pw_9csamtools_4Outs_9restore(PyObject *__pyx_self, PyObje
  *         if self.streams:
  */
 
-static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_4Outs_4restore(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_9csamtools_4Outs_4restore[] = "Outs.restore(self)\nrestore previous output stream";
+static PyMethodDef __pyx_mdef_9csamtools_4Outs_4restore = {__Pyx_NAMESTR("restore"), (PyCFunction)__pyx_pf_9csamtools_4Outs_4restore, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_4restore)};
+static PyObject *__pyx_pf_9csamtools_4Outs_4restore(PyObject *__pyx_self, PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -31984,8 +29973,9 @@ static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__py
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("restore", 0);
+  __Pyx_RefNannySetupContext("restore");
   __Pyx_TraceCall("restore", __pyx_f[0], 3114);
+  __pyx_self = __pyx_self;
 
   /* "csamtools.pyx":3116
  *     def restore(self):
@@ -32060,7 +30050,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__py
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
@@ -32091,7 +30081,7 @@ static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__py
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     __pyx_t_3 = 0;
@@ -32112,9 +30102,9 @@ static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__py
     __Pyx_GOTREF(__pyx_t_3);
     if (__Pyx_DelItemInt(__pyx_t_3, -1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -32132,18 +30122,65 @@ static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+/* "csamtools.pyx":3125
+ *             del self.streams[-1]
+ * 
+ * def _samtools_dispatch( method,             # <<<<<<<<<<<<<<
+ *                         args = (),
+ *                         catch_stdout = True ):
+ */
+
+static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_9csamtools__samtools_dispatch[] = "_samtools_dispatch(method, args=(), catch_stdout=True)\ncall ``method`` in samtools providing arguments in args.\n    \n    .. note:: \n       This method redirects stdout to capture it \n       from samtools. If for some reason stdout disappears\n       the reason might be in this method.\n\n    .. note::\n       The current implementation might only work on linux.\n\n    .. note::\n       This method captures stdout and stderr us [...]
-static PyMethodDef __pyx_mdef_9csamtools_1_samtools_dispatch = {__Pyx_NAMESTR("_samtools_dispatch"), (PyCFunction)__pyx_pw_9csamtools_1_samtools_dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools__samtools_dispatch)};
-static PyObject *__pyx_pw_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyMethodDef __pyx_mdef_9csamtools__samtools_dispatch = {__Pyx_NAMESTR("_samtools_dispatch"), (PyCFunction)__pyx_pf_9csamtools__samtools_dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools__samtools_dispatch)};
+static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_method = 0;
   PyObject *__pyx_v_args = 0;
   PyObject *__pyx_v_catch_stdout = 0;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__method,&__pyx_n_s__args,&__pyx_n_s__catch_stdout,0};
-  PyObject *__pyx_r = 0;
+  PyObject *__pyx_v_stderr_h = NULL;
+  PyObject *__pyx_v_stderr_f = NULL;
+  PyObject *__pyx_v_stdout_h = NULL;
+  PyObject *__pyx_v_stdout_f = NULL;
+  PyObject *__pyx_v_stdout_save = NULL;
+  char **__pyx_v_cargs;
+  int __pyx_v_i;
+  int __pyx_v_n;
+  int __pyx_v_retval;
+  PyObject *__pyx_v_inf = NULL;
+  PyObject *__pyx_v_out_stdout = NULL;
+  PyObject *__pyx_v_out_stderr = NULL;
+  PyObject *__pyx_v_a = NULL;
+  PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_samtools_dispatch (wrapper)", 0);
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  int __pyx_t_8;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  Py_ssize_t __pyx_t_12;
+  PyObject *(*__pyx_t_13)(PyObject *);
+  char *__pyx_t_14;
+  PyObject *__pyx_t_15 = NULL;
+  PyObject *__pyx_t_16 = NULL;
+  PyObject *__pyx_t_17 = NULL;
+  PyObject *__pyx_t_18 = NULL;
+  PyObject *__pyx_t_19 = NULL;
+  PyObject *__pyx_t_20 = NULL;
+  PyObject *__pyx_t_21 = NULL;
+  PyObject *__pyx_t_22 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__method,&__pyx_n_s__args,&__pyx_n_s__catch_stdout,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("_samtools_dispatch");
+  __Pyx_TraceCall("_samtools_dispatch", __pyx_f[0], 3125);
   __pyx_self = __pyx_self;
   {
     PyObject* values[3] = {0,0,0};
@@ -32159,8 +30196,7 @@ static PyObject *__pyx_pw_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, P
     values[2] = __pyx_k_176;
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
@@ -32168,7 +30204,7 @@ static PyObject *__pyx_pw_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, P
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method);
         if (likely(values[0])) kw_args--;
@@ -32185,7 +30221,7 @@ static PyObject *__pyx_pw_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, P
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_samtools_dispatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_samtools_dispatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -32208,63 +30244,6 @@ static PyObject *__pyx_pw_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, P
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_9csamtools__samtools_dispatch(__pyx_self, __pyx_v_method, __pyx_v_args, __pyx_v_catch_stdout);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "csamtools.pyx":3125
- *             del self.streams[-1]
- * 
- * def _samtools_dispatch( method,             # <<<<<<<<<<<<<<
- *                         args = (),
- *                         catch_stdout = True ):
- */
-
-static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_method, PyObject *__pyx_v_args, PyObject *__pyx_v_catch_stdout) {
-  PyObject *__pyx_v_stderr_h = NULL;
-  PyObject *__pyx_v_stderr_f = NULL;
-  PyObject *__pyx_v_stdout_h = NULL;
-  PyObject *__pyx_v_stdout_f = NULL;
-  PyObject *__pyx_v_stdout_save = NULL;
-  char **__pyx_v_cargs;
-  int __pyx_v_i;
-  int __pyx_v_n;
-  int __pyx_v_retval;
-  PyObject *__pyx_v_inf = NULL;
-  PyObject *__pyx_v_out_stdout = NULL;
-  PyObject *__pyx_v_out_stderr = NULL;
-  PyObject *__pyx_v_a = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  int __pyx_t_5;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *(*__pyx_t_7)(PyObject *);
-  int __pyx_t_8;
-  PyObject *__pyx_t_9 = NULL;
-  PyObject *__pyx_t_10 = NULL;
-  PyObject *__pyx_t_11 = NULL;
-  Py_ssize_t __pyx_t_12;
-  PyObject *(*__pyx_t_13)(PyObject *);
-  char *__pyx_t_14;
-  PyObject *__pyx_t_15 = NULL;
-  PyObject *__pyx_t_16 = NULL;
-  PyObject *__pyx_t_17 = NULL;
-  PyObject *__pyx_t_18 = NULL;
-  PyObject *__pyx_t_19 = NULL;
-  PyObject *__pyx_t_20 = NULL;
-  PyObject *__pyx_t_21 = NULL;
-  PyObject *__pyx_t_22 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_samtools_dispatch", 0);
-  __Pyx_TraceCall("_samtools_dispatch", __pyx_f[0], 3125);
   __Pyx_INCREF(__pyx_v_method);
   __Pyx_INCREF(__pyx_v_args);
   __Pyx_INCREF(__pyx_v_catch_stdout);
@@ -32297,7 +30276,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
     __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     __pyx_t_3 = 0;
@@ -32323,7 +30302,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
       PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
       __pyx_t_4 = 0;
@@ -32333,12 +30312,12 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L4;
+      goto __pyx_L7;
     }
-    __pyx_L4:;
-    goto __pyx_L3;
+    __pyx_L7:;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":3156
  * 
@@ -32383,19 +30362,19 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
+    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
+    index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_2);
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    goto __pyx_L6_unpacking_done;
-    __pyx_L5_unpacking_failed:;
+    goto __pyx_L9_unpacking_done;
+    __pyx_L8_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
     if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_L6_unpacking_done:;
+    __pyx_L9_unpacking_done:;
   }
   __pyx_v_stderr_h = __pyx_t_3;
   __pyx_t_3 = 0;
@@ -32465,19 +30444,19 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
-      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed;
+      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_2);
-      index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
+      index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_3);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      goto __pyx_L9_unpacking_done;
-      __pyx_L8_unpacking_failed:;
+      goto __pyx_L12_unpacking_done;
+      __pyx_L11_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
       if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_L9_unpacking_done:;
+      __pyx_L12_unpacking_done:;
     }
     __pyx_v_stdout_h = __pyx_t_2;
     __pyx_t_2 = 0;
@@ -32505,25 +30484,25 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *             stdout_save.setfd( stdout_h )
  *         except AttributeError:
  */
-        __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
         __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
         PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
         __Pyx_GIVEREF(__pyx_t_2);
         __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
@@ -32537,14 +30516,14 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *         except AttributeError:
  *             # stdout has already been redirected
  */
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
         __Pyx_INCREF(__pyx_v_stdout_h);
         PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_h);
         __Pyx_GIVEREF(__pyx_v_stdout_h);
-        __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+        __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
@@ -32553,8 +30532,8 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
-      goto __pyx_L17_try_end;
-      __pyx_L10_error:;
+      goto __pyx_L20_try_end;
+      __pyx_L13_error:;
       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -32570,7 +30549,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
       __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
       if (__pyx_t_8) {
         __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_GOTREF(__pyx_t_2);
@@ -32582,7 +30561,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  * 
  *         # patch for `samtools view`
  */
-        __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __Pyx_DECREF(__pyx_v_catch_stdout);
         __pyx_v_catch_stdout = __pyx_t_6;
@@ -32590,20 +30569,20 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        goto __pyx_L11_exception_handled;
+        goto __pyx_L14_exception_handled;
       }
-      __pyx_L12_except_error:;
+      __pyx_L15_except_error:;
       __Pyx_XGIVEREF(__pyx_t_9);
       __Pyx_XGIVEREF(__pyx_t_10);
       __Pyx_XGIVEREF(__pyx_t_11);
       __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
       goto __pyx_L1_error;
-      __pyx_L11_exception_handled:;
+      __pyx_L14_exception_handled:;
       __Pyx_XGIVEREF(__pyx_t_9);
       __Pyx_XGIVEREF(__pyx_t_10);
       __Pyx_XGIVEREF(__pyx_t_11);
       __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
-      __pyx_L17_try_end:;
+      __pyx_L20_try_end:;
     }
 
     /* "csamtools.pyx":3171
@@ -32630,9 +30609,9 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
         __Pyx_Raise(__pyx_t_2, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L21;
+        goto __pyx_L24;
       }
-      __pyx_L21:;
+      __pyx_L24:;
 
       /* "csamtools.pyx":3173
  *         if method == "view":
@@ -32642,7 +30621,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *     # do the function call to samtools
  */
       __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(((PyObject *)__pyx_kp_s_178));
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_178));
       __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_178));
@@ -32655,12 +30634,12 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
       __Pyx_DECREF(__pyx_v_args);
       __pyx_v_args = __pyx_t_3;
       __pyx_t_3 = 0;
-      goto __pyx_L20;
+      goto __pyx_L23;
     }
-    __pyx_L20:;
-    goto __pyx_L7;
+    __pyx_L23:;
+    goto __pyx_L10;
   }
-  __pyx_L7:;
+  __pyx_L10:;
 
   /* "csamtools.pyx":3179
  *     cdef int i, n, retval
@@ -32693,7 +30672,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *     # allocate two more for first (dummy) argument (contains command)
  */
   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   if (PyList_CheckExact(__pyx_v_args) || PyTuple_CheckExact(__pyx_v_args)) {
     __pyx_t_2 = __pyx_v_args; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
     __pyx_t_13 = NULL;
@@ -32703,10 +30682,10 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
     __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_2)) {
+    if (PyList_CheckExact(__pyx_t_2)) {
       if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break;
       __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++;
-    } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_2)) {
+    } else if (PyTuple_CheckExact(__pyx_t_2)) {
       if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
       __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++;
     } else {
@@ -32805,6 +30784,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  */
   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
+    if (unlikely(!__pyx_v_stdout_save)) { __Pyx_RaiseUnboundLocalError("stdout_save"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_3 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "csamtools.pyx":3195
  *     # needs to be before reading back the file contents
@@ -32813,8 +30793,6 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *         try:
  *             with open( stdout_f, "r") as inf:
  */
-    if (unlikely(!__pyx_v_stdout_save)) { __Pyx_RaiseUnboundLocalError("stdout_save"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
@@ -32843,26 +30821,25 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *         except UnicodeDecodeError:
  */
         /*with:*/ {
-          if (unlikely(!__pyx_v_stdout_f)) { __Pyx_RaiseUnboundLocalError("stdout_f"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;} }
-          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
-          __Pyx_GOTREF(__pyx_t_2);
+          if (unlikely(!__pyx_v_stdout_f)) { __Pyx_RaiseUnboundLocalError("stdout_f"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L30_error;} }__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L30_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_2));
           __Pyx_INCREF(__pyx_v_stdout_f);
           PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stdout_f);
           __Pyx_GIVEREF(__pyx_v_stdout_f);
           __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
           PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__r));
           __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
-          __pyx_t_3 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
+          __pyx_t_3 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L30_error;}
           __Pyx_GOTREF(__pyx_t_3);
           __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-          __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
+          __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L30_error;}
           __Pyx_GOTREF(__pyx_t_15);
-          __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L35_error;}
+          __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L38_error;}
           __Pyx_GOTREF(__pyx_t_2);
-          __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L35_error;}
-          __Pyx_GOTREF(__pyx_t_4);
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+          __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L38_error;}
+          __Pyx_GOTREF(__pyx_t_3);
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
           /*try:*/ {
             {
               __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
@@ -32870,9 +30847,8 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
               __Pyx_XGOTREF(__pyx_t_17);
               __Pyx_XGOTREF(__pyx_t_18);
               /*try:*/ {
-                __Pyx_INCREF(__pyx_t_4);
-                __pyx_v_inf = __pyx_t_4;
-                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                __pyx_v_inf = __pyx_t_3;
+                __pyx_t_3 = 0;
 
                 /* "csamtools.pyx":3198
  *         try:
@@ -32881,23 +30857,23 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *         except UnicodeDecodeError:
  *             with open( stdout_f, "rb") as inf:
  */
-                __pyx_t_4 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__readlines); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3198; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
-                __Pyx_GOTREF(__pyx_t_4);
-                __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3198; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
+                __pyx_t_3 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__readlines); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3198; __pyx_clineno = __LINE__; goto __pyx_L44_error;}
                 __Pyx_GOTREF(__pyx_t_3);
-                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-                __pyx_v_out_stdout = __pyx_t_3;
-                __pyx_t_3 = 0;
+                __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3198; __pyx_clineno = __LINE__; goto __pyx_L44_error;}
+                __Pyx_GOTREF(__pyx_t_2);
+                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+                __pyx_v_out_stdout = __pyx_t_2;
+                __pyx_t_2 = 0;
               }
               __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
               __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
               __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
-              goto __pyx_L48_try_end;
-              __pyx_L41_error:;
+              goto __pyx_L51_try_end;
+              __pyx_L44_error:;
               __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
               __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
               __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
               /* "csamtools.pyx":3197
  *         stdout_save.restore()
@@ -32908,86 +30884,86 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  */
               /*except:*/ {
                 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-                if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
+                if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L46_except_error;}
+                __Pyx_GOTREF(__pyx_t_2);
                 __Pyx_GOTREF(__pyx_t_3);
                 __Pyx_GOTREF(__pyx_t_4);
-                __Pyx_GOTREF(__pyx_t_2);
-                __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
-                __Pyx_GOTREF(__pyx_t_6);
+                __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L46_except_error;}
+                __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+                __Pyx_INCREF(__pyx_t_2);
+                PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
+                __Pyx_GIVEREF(__pyx_t_2);
                 __Pyx_INCREF(__pyx_t_3);
-                PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
+                PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
                 __Pyx_GIVEREF(__pyx_t_3);
                 __Pyx_INCREF(__pyx_t_4);
-                PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
+                PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
                 __Pyx_GIVEREF(__pyx_t_4);
-                __Pyx_INCREF(__pyx_t_2);
-                PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
-                __Pyx_GIVEREF(__pyx_t_2);
                 __pyx_t_19 = PyObject_Call(__pyx_t_15, __pyx_t_6, NULL);
                 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-                if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
+                if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L46_except_error;}
                 __Pyx_GOTREF(__pyx_t_19);
                 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_19);
                 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
-                if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
+                if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L46_except_error;}
                 __pyx_t_1 = (!__pyx_t_5);
                 if (__pyx_t_1) {
+                  __Pyx_GIVEREF(__pyx_t_2);
                   __Pyx_GIVEREF(__pyx_t_3);
                   __Pyx_GIVEREF(__pyx_t_4);
-                  __Pyx_GIVEREF(__pyx_t_2);
-                  __Pyx_ErrRestore(__pyx_t_3, __pyx_t_4, __pyx_t_2);
-                  __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_2 = 0; 
-                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
-                  goto __pyx_L52;
+                  __Pyx_ErrRestore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+                  __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
+                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L46_except_error;}
+                  goto __pyx_L54;
                 }
-                __pyx_L52:;
+                __pyx_L54:;
                 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-                goto __pyx_L42_exception_handled;
+                goto __pyx_L45_exception_handled;
               }
-              __pyx_L43_except_error:;
+              __pyx_L46_except_error:;
               __Pyx_XGIVEREF(__pyx_t_16);
               __Pyx_XGIVEREF(__pyx_t_17);
               __Pyx_XGIVEREF(__pyx_t_18);
               __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
-              goto __pyx_L27_error;
-              __pyx_L42_exception_handled:;
+              goto __pyx_L30_error;
+              __pyx_L45_exception_handled:;
               __Pyx_XGIVEREF(__pyx_t_16);
               __Pyx_XGIVEREF(__pyx_t_17);
               __Pyx_XGIVEREF(__pyx_t_18);
               __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
-              __pyx_L48_try_end:;
+              __pyx_L51_try_end:;
             }
           }
           /*finally:*/ {
             if (__pyx_t_15) {
               __pyx_t_18 = PyObject_Call(__pyx_t_15, __pyx_k_tuple_181, NULL);
               __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-              if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
+              if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L30_error;}
               __Pyx_GOTREF(__pyx_t_18);
               __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_18);
               __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-              if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
+              if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L30_error;}
             }
           }
-          goto __pyx_L53;
-          __pyx_L35_error:;
+          goto __pyx_L55;
+          __pyx_L38_error:;
           __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-          goto __pyx_L27_error;
-          __pyx_L53:;
+          goto __pyx_L30_error;
+          __pyx_L55:;
         }
       }
       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
-      goto __pyx_L34_try_end;
-      __pyx_L27_error:;
+      goto __pyx_L37_try_end;
+      __pyx_L30_error:;
       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
       /* "csamtools.pyx":3199
  *             with open( stdout_f, "r") as inf:
@@ -32999,10 +30975,10 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
       __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
       if (__pyx_t_8) {
         __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3199; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3199; __pyx_clineno = __LINE__; goto __pyx_L32_except_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_GOTREF(__pyx_t_2);
 
         /* "csamtools.pyx":3200
  *                 out_stdout = inf.readlines()
@@ -33012,25 +30988,25 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *                 out_stdout = inf.read()
  */
         /*with:*/ {
-          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
-          __Pyx_GOTREF(__pyx_t_6);
+          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L32_except_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
           __Pyx_INCREF(__pyx_v_stdout_f);
           PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_stdout_f);
           __Pyx_GIVEREF(__pyx_v_stdout_f);
           __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
           PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__rb));
           __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
-          __pyx_t_20 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
+          __pyx_t_20 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L32_except_error;}
           __Pyx_GOTREF(__pyx_t_20);
           __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-          __pyx_t_15 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
+          __pyx_t_15 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L32_except_error;}
           __Pyx_GOTREF(__pyx_t_15);
-          __pyx_t_6 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s____enter__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+          __pyx_t_6 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s____enter__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
           __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_21 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-          __Pyx_GOTREF(__pyx_t_21);
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+          __pyx_t_20 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
+          __Pyx_GOTREF(__pyx_t_20);
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
           /*try:*/ {
             {
               __Pyx_ExceptionSave(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
@@ -33038,10 +31014,9 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
               __Pyx_XGOTREF(__pyx_t_17);
               __Pyx_XGOTREF(__pyx_t_16);
               /*try:*/ {
-                __Pyx_INCREF(__pyx_t_21);
                 __Pyx_XDECREF(__pyx_v_inf);
-                __pyx_v_inf = __pyx_t_21;
-                __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
+                __pyx_v_inf = __pyx_t_20;
+                __pyx_t_20 = 0;
 
                 /* "csamtools.pyx":3202
  *             with open( stdout_f, "rb") as inf:
@@ -33050,23 +31025,22 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *         os.remove( stdout_f )
  *     else:
  */
-                __pyx_t_21 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__read); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3202; __pyx_clineno = __LINE__; goto __pyx_L62_error;}
-                __Pyx_GOTREF(__pyx_t_21);
-                __pyx_t_20 = PyObject_Call(__pyx_t_21, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3202; __pyx_clineno = __LINE__; goto __pyx_L62_error;}
+                __pyx_t_20 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__read); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3202; __pyx_clineno = __LINE__; goto __pyx_L64_error;}
                 __Pyx_GOTREF(__pyx_t_20);
-                __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
+                __pyx_t_6 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3202; __pyx_clineno = __LINE__; goto __pyx_L64_error;}
+                __Pyx_GOTREF(__pyx_t_6);
+                __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
                 __Pyx_XDECREF(__pyx_v_out_stdout);
-                __pyx_v_out_stdout = __pyx_t_20;
-                __pyx_t_20 = 0;
+                __pyx_v_out_stdout = __pyx_t_6;
+                __pyx_t_6 = 0;
               }
               __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
               __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
               __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-              goto __pyx_L69_try_end;
-              __pyx_L62_error:;
-              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-              __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
+              goto __pyx_L71_try_end;
+              __pyx_L64_error:;
               __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
+              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
 
               /* "csamtools.pyx":3200
  *                 out_stdout = inf.readlines()
@@ -33077,93 +31051,93 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  */
               /*except:*/ {
                 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-                if (__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
+                if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_20, &__pyx_t_21) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L66_except_error;}
+                __Pyx_GOTREF(__pyx_t_6);
                 __Pyx_GOTREF(__pyx_t_20);
                 __Pyx_GOTREF(__pyx_t_21);
-                __Pyx_GOTREF(__pyx_t_6);
-                __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
-                __Pyx_GOTREF(__pyx_t_22);
+                __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L66_except_error;}
+                __Pyx_GOTREF(((PyObject *)__pyx_t_22));
+                __Pyx_INCREF(__pyx_t_6);
+                PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_6);
+                __Pyx_GIVEREF(__pyx_t_6);
                 __Pyx_INCREF(__pyx_t_20);
-                PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_20);
+                PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
                 __Pyx_GIVEREF(__pyx_t_20);
                 __Pyx_INCREF(__pyx_t_21);
-                PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_21);
+                PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_21);
                 __Pyx_GIVEREF(__pyx_t_21);
-                __Pyx_INCREF(__pyx_t_6);
-                PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_6);
-                __Pyx_GIVEREF(__pyx_t_6);
                 __pyx_t_19 = PyObject_Call(__pyx_t_15, __pyx_t_22, NULL);
                 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-                if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
+                if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L66_except_error;}
                 __Pyx_GOTREF(__pyx_t_19);
                 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_19);
                 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
-                if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
+                if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L66_except_error;}
                 __pyx_t_5 = (!__pyx_t_1);
                 if (__pyx_t_5) {
+                  __Pyx_GIVEREF(__pyx_t_6);
                   __Pyx_GIVEREF(__pyx_t_20);
                   __Pyx_GIVEREF(__pyx_t_21);
-                  __Pyx_GIVEREF(__pyx_t_6);
-                  __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_6);
-                  __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_6 = 0; 
-                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
-                  goto __pyx_L73;
+                  __Pyx_ErrRestore(__pyx_t_6, __pyx_t_20, __pyx_t_21);
+                  __pyx_t_6 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; 
+                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L66_except_error;}
+                  goto __pyx_L74;
                 }
-                __pyx_L73:;
+                __pyx_L74:;
                 __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
+                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
                 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
-                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-                goto __pyx_L63_exception_handled;
+                goto __pyx_L65_exception_handled;
               }
-              __pyx_L64_except_error:;
+              __pyx_L66_except_error:;
               __Pyx_XGIVEREF(__pyx_t_18);
               __Pyx_XGIVEREF(__pyx_t_17);
               __Pyx_XGIVEREF(__pyx_t_16);
               __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
-              goto __pyx_L29_except_error;
-              __pyx_L63_exception_handled:;
+              goto __pyx_L32_except_error;
+              __pyx_L65_exception_handled:;
               __Pyx_XGIVEREF(__pyx_t_18);
               __Pyx_XGIVEREF(__pyx_t_17);
               __Pyx_XGIVEREF(__pyx_t_16);
               __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
-              __pyx_L69_try_end:;
+              __pyx_L71_try_end:;
             }
           }
           /*finally:*/ {
             if (__pyx_t_15) {
               __pyx_t_16 = PyObject_Call(__pyx_t_15, __pyx_k_tuple_182, NULL);
               __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-              if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
+              if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L32_except_error;}
               __Pyx_GOTREF(__pyx_t_16);
               __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_16);
               __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-              if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
+              if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L32_except_error;}
             }
           }
-          goto __pyx_L74;
-          __pyx_L56_error:;
+          goto __pyx_L75;
+          __pyx_L58_error:;
           __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-          goto __pyx_L29_except_error;
-          __pyx_L74:;
+          goto __pyx_L32_except_error;
+          __pyx_L75:;
         }
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        goto __pyx_L28_exception_handled;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        goto __pyx_L31_exception_handled;
       }
-      __pyx_L29_except_error:;
+      __pyx_L32_except_error:;
       __Pyx_XGIVEREF(__pyx_t_11);
       __Pyx_XGIVEREF(__pyx_t_10);
       __Pyx_XGIVEREF(__pyx_t_9);
       __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
       goto __pyx_L1_error;
-      __pyx_L28_exception_handled:;
+      __pyx_L31_exception_handled:;
       __Pyx_XGIVEREF(__pyx_t_11);
       __Pyx_XGIVEREF(__pyx_t_10);
       __Pyx_XGIVEREF(__pyx_t_9);
       __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
-      __pyx_L34_try_end:;
+      __pyx_L37_try_end:;
     }
 
     /* "csamtools.pyx":3203
@@ -33173,22 +31147,22 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *     else:
  *         out_stdout = []
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_stdout_f);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_f);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stdout_f);
     __Pyx_GIVEREF(__pyx_v_stdout_f);
-    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    goto __pyx_L26;
+    goto __pyx_L29;
   }
   /*else*/ {
 
@@ -33199,12 +31173,12 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  * 
  *     # get error messages
  */
-    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_v_out_stdout = ((PyObject *)__pyx_t_2);
-    __pyx_t_2 = 0;
+    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_v_out_stdout = ((PyObject *)__pyx_t_4);
+    __pyx_t_4 = 0;
   }
-  __pyx_L26:;
+  __pyx_L29:;
 
   /* "csamtools.pyx":3208
  * 
@@ -33237,25 +31211,25 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *     except UnicodeDecodeError:
  */
       /*with:*/ {
-        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L76_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
         __Pyx_INCREF(__pyx_v_stderr_f);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stderr_f);
+        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stderr_f);
         __Pyx_GIVEREF(__pyx_v_stderr_f);
         __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
-        PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__r));
+        PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__r));
         __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-        __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
-        __Pyx_GOTREF(__pyx_t_15);
-        __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L83_error;}
+        __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L76_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L83_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+        __pyx_t_15 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L76_error;}
+        __Pyx_GOTREF(__pyx_t_15);
+        __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L84_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L84_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         /*try:*/ {
           {
             __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
@@ -33263,10 +31237,9 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
             __Pyx_XGOTREF(__pyx_t_17);
             __Pyx_XGOTREF(__pyx_t_18);
             /*try:*/ {
-              __Pyx_INCREF(__pyx_t_4);
               __Pyx_XDECREF(__pyx_v_inf);
-              __pyx_v_inf = __pyx_t_4;
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_v_inf = __pyx_t_2;
+              __pyx_t_2 = 0;
 
               /* "csamtools.pyx":3211
  *     try:
@@ -33275,26 +31248,26 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *     except UnicodeDecodeError:
  *         with open( stderr_f, "rb") as inf:
  */
-              __pyx_t_4 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__readlines); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3211; __pyx_clineno = __LINE__; goto __pyx_L89_error;}
+              __pyx_t_2 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__readlines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3211; __pyx_clineno = __LINE__; goto __pyx_L90_error;}
+              __Pyx_GOTREF(__pyx_t_2);
+              __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3211; __pyx_clineno = __LINE__; goto __pyx_L90_error;}
               __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3211; __pyx_clineno = __LINE__; goto __pyx_L89_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __pyx_v_out_stderr = __pyx_t_3;
-              __pyx_t_3 = 0;
+              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+              __pyx_v_out_stderr = __pyx_t_4;
+              __pyx_t_4 = 0;
             }
             __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
             __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
             __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
-            goto __pyx_L96_try_end;
-            __pyx_L89_error:;
+            goto __pyx_L97_try_end;
+            __pyx_L90_error:;
             __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
+            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
             __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
             __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
-            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
             __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
             __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
             /* "csamtools.pyx":3210
  *     pysam_unset_stderr()
@@ -33305,74 +31278,74 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  */
             /*except:*/ {
               __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-              if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
-              __Pyx_GOTREF(__pyx_t_3);
+              if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L92_except_error;}
               __Pyx_GOTREF(__pyx_t_4);
               __Pyx_GOTREF(__pyx_t_2);
-              __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
-              __Pyx_GOTREF(__pyx_t_6);
-              __Pyx_INCREF(__pyx_t_3);
-              PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
-              __Pyx_GIVEREF(__pyx_t_3);
+              __Pyx_GOTREF(__pyx_t_3);
+              __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L92_except_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_21));
               __Pyx_INCREF(__pyx_t_4);
-              PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
+              PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_4);
               __Pyx_GIVEREF(__pyx_t_4);
               __Pyx_INCREF(__pyx_t_2);
-              PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
+              PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_2);
               __Pyx_GIVEREF(__pyx_t_2);
-              __pyx_t_19 = PyObject_Call(__pyx_t_15, __pyx_t_6, NULL);
+              __Pyx_INCREF(__pyx_t_3);
+              PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_3);
+              __Pyx_GIVEREF(__pyx_t_3);
+              __pyx_t_19 = PyObject_Call(__pyx_t_15, __pyx_t_21, NULL);
               __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-              if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
+              if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L92_except_error;}
               __Pyx_GOTREF(__pyx_t_19);
               __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_19);
               __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
-              if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
+              if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L92_except_error;}
               __pyx_t_1 = (!__pyx_t_5);
               if (__pyx_t_1) {
-                __Pyx_GIVEREF(__pyx_t_3);
                 __Pyx_GIVEREF(__pyx_t_4);
                 __Pyx_GIVEREF(__pyx_t_2);
-                __Pyx_ErrRestore(__pyx_t_3, __pyx_t_4, __pyx_t_2);
-                __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_2 = 0; 
-                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
+                __Pyx_GIVEREF(__pyx_t_3);
+                __Pyx_ErrRestore(__pyx_t_4, __pyx_t_2, __pyx_t_3);
+                __pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; 
+                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L92_except_error;}
                 goto __pyx_L100;
               }
               __pyx_L100:;
-              __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_21)); __pyx_t_21 = 0;
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-              goto __pyx_L90_exception_handled;
+              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+              goto __pyx_L91_exception_handled;
             }
-            __pyx_L91_except_error:;
+            __pyx_L92_except_error:;
             __Pyx_XGIVEREF(__pyx_t_16);
             __Pyx_XGIVEREF(__pyx_t_17);
             __Pyx_XGIVEREF(__pyx_t_18);
             __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
-            goto __pyx_L75_error;
-            __pyx_L90_exception_handled:;
+            goto __pyx_L76_error;
+            __pyx_L91_exception_handled:;
             __Pyx_XGIVEREF(__pyx_t_16);
             __Pyx_XGIVEREF(__pyx_t_17);
             __Pyx_XGIVEREF(__pyx_t_18);
             __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
-            __pyx_L96_try_end:;
+            __pyx_L97_try_end:;
           }
         }
         /*finally:*/ {
           if (__pyx_t_15) {
             __pyx_t_18 = PyObject_Call(__pyx_t_15, __pyx_k_tuple_183, NULL);
             __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-            if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
+            if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L76_error;}
             __Pyx_GOTREF(__pyx_t_18);
             __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_18);
             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-            if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
+            if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L76_error;}
           }
         }
         goto __pyx_L101;
-        __pyx_L83_error:;
+        __pyx_L84_error:;
         __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-        goto __pyx_L75_error;
+        goto __pyx_L76_error;
         __pyx_L101:;
       }
     }
@@ -33385,24 +31358,24 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  * 
  *     return retval, out_stderr, out_stdout
  */
-      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
       __Pyx_XDECREF(__pyx_v_out_stderr);
-      __pyx_v_out_stderr = ((PyObject *)__pyx_t_2);
-      __pyx_t_2 = 0;
+      __pyx_v_out_stderr = ((PyObject *)__pyx_t_3);
+      __pyx_t_3 = 0;
     }
     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
     __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
-    goto __pyx_L82_try_end;
-    __pyx_L75_error:;
+    goto __pyx_L83_try_end;
+    __pyx_L76_error:;
     __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
+    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
     __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
-    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
     /* "csamtools.pyx":3212
  *         with open( stderr_f, "r") as inf:
@@ -33414,10 +31387,10 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
     __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
     if (__pyx_t_8) {
       __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3212; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
+      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3212; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_GOTREF(__pyx_t_3);
 
       /* "csamtools.pyx":3213
  *             out_stderr = inf.readlines()
@@ -33427,24 +31400,24 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *             out_stderr = inf.read()
  */
       /*with:*/ {
-        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_21));
         __Pyx_INCREF(__pyx_v_stderr_f);
-        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_stderr_f);
+        PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_v_stderr_f);
         __Pyx_GIVEREF(__pyx_v_stderr_f);
         __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
-        PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__rb));
+        PyTuple_SET_ITEM(__pyx_t_21, 1, ((PyObject *)__pyx_n_s__rb));
         __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
-        __pyx_t_21 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
-        __Pyx_GOTREF(__pyx_t_21);
-        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-        __pyx_t_15 = PyObject_GetAttr(__pyx_t_21, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
+        __pyx_t_20 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_21), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
+        __Pyx_GOTREF(__pyx_t_20);
+        __Pyx_DECREF(((PyObject *)__pyx_t_21)); __pyx_t_21 = 0;
+        __pyx_t_15 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
         __Pyx_GOTREF(__pyx_t_15);
-        __pyx_t_6 = PyObject_GetAttr(__pyx_t_21, __pyx_n_s____enter__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L104_error;}
-        __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_20 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L104_error;}
+        __pyx_t_21 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s____enter__); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L104_error;}
+        __Pyx_GOTREF(__pyx_t_21);
+        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+        __pyx_t_20 = PyObject_Call(__pyx_t_21, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L104_error;}
         __Pyx_GOTREF(__pyx_t_20);
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
         /*try:*/ {
           {
@@ -33453,10 +31426,9 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
             __Pyx_XGOTREF(__pyx_t_17);
             __Pyx_XGOTREF(__pyx_t_16);
             /*try:*/ {
-              __Pyx_INCREF(__pyx_t_20);
               __Pyx_XDECREF(__pyx_v_inf);
               __pyx_v_inf = __pyx_t_20;
-              __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+              __pyx_t_20 = 0;
 
               /* "csamtools.pyx":3215
  *         with open( stderr_f, "rb") as inf:
@@ -33498,7 +31470,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
               __Pyx_GOTREF(__pyx_t_20);
               __Pyx_GOTREF(__pyx_t_6);
               __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
-              __Pyx_GOTREF(__pyx_t_22);
+              __Pyx_GOTREF(((PyObject *)__pyx_t_22));
               __Pyx_INCREF(__pyx_t_21);
               PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_21);
               __Pyx_GIVEREF(__pyx_t_21);
@@ -33523,9 +31495,9 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
                 __Pyx_ErrRestore(__pyx_t_21, __pyx_t_20, __pyx_t_6);
                 __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_6 = 0; 
                 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
-                goto __pyx_L121;
+                goto __pyx_L120;
               }
-              __pyx_L121:;
+              __pyx_L120:;
               __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
               __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
               __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
@@ -33537,7 +31509,7 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
             __Pyx_XGIVEREF(__pyx_t_17);
             __Pyx_XGIVEREF(__pyx_t_16);
             __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
-            goto __pyx_L77_except_error;
+            goto __pyx_L78_except_error;
             __pyx_L111_exception_handled:;
             __Pyx_XGIVEREF(__pyx_t_18);
             __Pyx_XGIVEREF(__pyx_t_17);
@@ -33550,18 +31522,18 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
           if (__pyx_t_15) {
             __pyx_t_16 = PyObject_Call(__pyx_t_15, __pyx_k_tuple_184, NULL);
             __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-            if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
+            if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
             __Pyx_GOTREF(__pyx_t_16);
             __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_16);
             __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-            if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
+            if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
           }
         }
-        goto __pyx_L122;
+        goto __pyx_L121;
         __pyx_L104_error:;
         __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-        goto __pyx_L77_except_error;
-        __pyx_L122:;
+        goto __pyx_L78_except_error;
+        __pyx_L121:;
       }
 
       /* "csamtools.pyx":3216
@@ -33571,38 +31543,38 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  *     else:
  *         out_stderr = []
  */
-      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
+      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_20 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__remove); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
+      __pyx_t_20 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__remove); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
       __Pyx_GOTREF(__pyx_t_20);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
-      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       __Pyx_INCREF(__pyx_v_stderr_f);
       PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_stderr_f);
       __Pyx_GIVEREF(__pyx_v_stderr_f);
-      __pyx_t_21 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
+      __pyx_t_21 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L78_except_error;}
       __Pyx_GOTREF(__pyx_t_21);
       __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      goto __pyx_L76_exception_handled;
+      goto __pyx_L77_exception_handled;
     }
-    __pyx_L77_except_error:;
+    __pyx_L78_except_error:;
     __Pyx_XGIVEREF(__pyx_t_9);
     __Pyx_XGIVEREF(__pyx_t_10);
     __Pyx_XGIVEREF(__pyx_t_11);
     __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
     goto __pyx_L1_error;
-    __pyx_L76_exception_handled:;
+    __pyx_L77_exception_handled:;
     __Pyx_XGIVEREF(__pyx_t_9);
     __Pyx_XGIVEREF(__pyx_t_10);
     __Pyx_XGIVEREF(__pyx_t_11);
     __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
-    __pyx_L82_try_end:;
+    __pyx_L83_try_end:;
   }
 
   /* "csamtools.pyx":3220
@@ -33613,23 +31585,21 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
  * cdef class SNPCall:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  if (unlikely(!__pyx_v_out_stderr)) { __Pyx_RaiseUnboundLocalError("out_stderr"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-  if (unlikely(!__pyx_v_out_stdout)) { __Pyx_RaiseUnboundLocalError("out_stdout"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
+  if (unlikely(!__pyx_v_out_stderr)) { __Pyx_RaiseUnboundLocalError("out_stderr"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (unlikely(!__pyx_v_out_stdout)) { __Pyx_RaiseUnboundLocalError("out_stdout"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE_ [...]
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
   __Pyx_INCREF(__pyx_v_out_stderr);
-  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_out_stderr);
+  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_out_stderr);
   __Pyx_GIVEREF(__pyx_v_out_stderr);
   __Pyx_INCREF(__pyx_v_out_stdout);
-  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_out_stdout);
+  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_out_stdout);
   __Pyx_GIVEREF(__pyx_v_out_stdout);
-  __pyx_t_3 = 0;
-  __pyx_r = ((PyObject *)__pyx_t_4);
   __pyx_t_4 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -33663,17 +31633,6 @@ static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_3tid_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall_3tid___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3235
  *     property tid:
  *         '''the chromosome ID as is defined in the header'''
@@ -33682,7 +31641,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_3tid_1__get__(PyObject *__pyx_v_se
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -33690,7 +31650,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3235);
 
   /* "csamtools.pyx":3236
@@ -33701,7 +31661,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_9csa
  *     property pos:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -33720,17 +31680,6 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_3pos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall_3pos___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3240
  *     property pos:
  *        '''nucleotide position of SNP.'''
@@ -33739,7 +31688,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_3pos_1__get__(PyObject *__pyx_v_se
  *     property reference_base:
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -33747,10 +31697,10 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3240);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -33769,17 +31719,6 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_14reference_base_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_14reference_base_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall_14reference_base___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3244
  *     property reference_base:
  *        '''reference base at pos. ``N`` if no reference sequence supplied.'''
@@ -33788,7 +31727,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_14reference_base_1__get__(PyObject
  *     property genotype:
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -33796,10 +31736,10 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(struct __
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3244);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_9csamtools_from_string_and_size((&__pyx_v_self->_reference_base), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_from_string_and_size((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_reference_base), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -33818,17 +31758,6 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_8genotype_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_8genotype_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall_8genotype___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3248
  *     property genotype:
  *        '''the genotype called.'''
@@ -33837,7 +31766,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_8genotype_1__get__(PyObject *__pyx
  *     property consensus_quality:
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -33845,10 +31775,10 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3248);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_9csamtools_from_string_and_size((&__pyx_v_self->_genotype), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_from_string_and_size((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_genotype), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -33867,17 +31797,6 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_17consensus_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_17consensus_quality_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3252
  *     property consensus_quality:
  *        '''the genotype quality (Phred-scaled).'''
@@ -33886,7 +31805,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_17consensus_quality_1__get__(PyObj
  *     property snp_quality:
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -33894,10 +31814,10 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(struct
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3252);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_consensus_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_consensus_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -33916,17 +31836,6 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_11snp_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_11snp_quality_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3256
  *     property snp_quality:
  *        '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.'''
@@ -33935,7 +31844,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_11snp_quality_1__get__(PyObject *_
  *     property mapping_quality:
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -33943,10 +31853,10 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(struct __pyx
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3256);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_snp_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_snp_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -33965,17 +31875,6 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_15mapping_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_15mapping_quality_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3260
  *     property mapping_quality:
  *        '''the root mean square (rms) of the mapping quality of all reads involved in the call.'''
@@ -33984,7 +31883,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_15mapping_quality_1__get__(PyObjec
  *     property coverage:
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -33992,10 +31892,10 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(struct _
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3260);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_rms_mapping_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_rms_mapping_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -34014,17 +31914,6 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_8coverage_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_8coverage_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall_8coverage___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3264
  *     property coverage:
  *        '''coverage or read depth - the number of reads involved in the call.'''
@@ -34033,7 +31922,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_8coverage_1__get__(PyObject *__pyx
  *     def __str__(self):
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -34041,10 +31931,10 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(struct __pyx_obj
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__get__", 0);
+  __Pyx_RefNannySetupContext("__get__");
   __Pyx_TraceCall("__get__", __pyx_f[0], 3264);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_coverage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_coverage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -34063,17 +31953,6 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_7SNPCall_1__str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_9csamtools_7SNPCall_1__str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_7SNPCall___str__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3266
  *        def __get__(self): return self._coverage
  * 
@@ -34082,7 +31961,8 @@ static PyObject *__pyx_pw_9csamtools_7SNPCall_1__str__(PyObject *__pyx_v_self) {
  *         return "\t".join( map(str, (
  */
 
-static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -34099,7 +31979,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__str__", 0);
+  __Pyx_RefNannySetupContext("__str__");
   __Pyx_TraceCall("__str__", __pyx_f[0], 3266);
 
   /* "csamtools.pyx":3268
@@ -34120,7 +32000,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
  *                     self.pos,
  *                     self.reference_base,
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
 
   /* "csamtools.pyx":3270
@@ -34130,7 +32010,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
  *                     self.reference_base,
  *                     self.genotype,
  */
-  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
 
   /* "csamtools.pyx":3271
@@ -34140,7 +32020,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
  *                     self.genotype,
  *                     self.consensus_quality,
  */
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reference_base); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reference_base); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
 
   /* "csamtools.pyx":3272
@@ -34150,7 +32030,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
  *                     self.consensus_quality,
  *                     self.snp_quality,
  */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__genotype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__genotype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
 
   /* "csamtools.pyx":3273
@@ -34160,7 +32040,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
  *                     self.snp_quality,
  *                     self.mapping_quality,
  */
-  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__consensus_quality); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__consensus_quality); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
 
   /* "csamtools.pyx":3274
@@ -34170,7 +32050,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
  *                     self.mapping_quality,
  *                     self.coverage ) ) )
  */
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__snp_quality); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__snp_quality); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
 
   /* "csamtools.pyx":3275
@@ -34180,7 +32060,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
  *                     self.coverage ) ) )
  * 
  */
-  __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mapping_quality); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapping_quality); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
 
   /* "csamtools.pyx":3276
@@ -34190,10 +32070,10 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
  * 
  * 
  */
-  __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__coverage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__coverage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
   PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
@@ -34219,7 +32099,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
   __pyx_t_8 = 0;
   __pyx_t_9 = 0;
   __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
   __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
   PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
@@ -34230,7 +32110,7 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
   __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
   __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
   PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
   __Pyx_GIVEREF(__pyx_t_10);
   __pyx_t_10 = 0;
@@ -34264,28 +32144,44 @@ static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtool
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "csamtools.pyx":3786
+ *     """
+ * 
+ *     def __init__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
+ *         self.samfile = samfile
+ * 
+ */
+
+static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
   int __pyx_v_reopen;
-  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
+  PyObject *__pyx_v_mode = NULL;
+  PyObject *__pyx_v_store = NULL;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  char *__pyx_t_3;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
+  __Pyx_TraceDeclarations
+  __Pyx_RefNannySetupContext("__init__");
+  __Pyx_TraceCall("__init__", __pyx_f[0], 3786);
   {
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
         case  0: break;
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
         values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
         if (likely(values[0])) kw_args--;
@@ -34297,19 +32193,7 @@ static int __pyx_pw_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v_self,
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-      if (values[1]) {
-      } else {
-
-        /* "csamtools.pyx":3786
- *     """
- * 
- *     def __init__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
- *         self.samfile = samfile
- * 
- */
-        __pyx_v_reopen = ((int)1);
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -34335,29 +32219,6 @@ static int __pyx_pw_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v_self,
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9csamtools_12IndexedReads___init__(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self), __pyx_v_samfile, __pyx_v_reopen);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen) {
-  PyObject *__pyx_v_mode = NULL;
-  PyObject *__pyx_v_store = NULL;
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  char *__pyx_t_3;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__init__", 0);
-  __Pyx_TraceCall("__init__", __pyx_f[0], 3786);
 
   /* "csamtools.pyx":3787
  * 
@@ -34368,9 +32229,9 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
  */
   __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
-  __Pyx_GOTREF(__pyx_v_self->samfile);
-  __Pyx_DECREF(((PyObject *)__pyx_v_self->samfile));
-  __pyx_v_self->samfile = __pyx_v_samfile;
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
+  ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile = __pyx_v_samfile;
 
   /* "csamtools.pyx":3789
  *         self.samfile = samfile
@@ -34382,7 +32243,7 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
   if (__pyx_v_samfile->isbam) {
     __Pyx_INCREF(((PyObject *)__pyx_n_b__rb));
     __pyx_v_mode = __pyx_n_b__rb;
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
   /*else*/ {
 
@@ -34396,7 +32257,7 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
     __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
     __pyx_v_mode = __pyx_n_b__r;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
   /* "csamtools.pyx":3794
  *         # reopen the file - note that this makes the iterator
@@ -34430,7 +32291,7 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
  *             assert self.fp != NULL
  */
     __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_mode)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_self->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_3, NULL);
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_3, NULL);
 
     /* "csamtools.pyx":3797
  *             store = StderrStore()
@@ -34454,7 +32315,7 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
  *         else:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    if (unlikely(!(__pyx_v_self->fp != NULL))) {
+    if (unlikely(!(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp != NULL))) {
       PyErr_SetNone(PyExc_AssertionError);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -34467,8 +32328,8 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
  *         else:
  *             self.fp = samfile.samfile
  */
-    __pyx_v_self->owns_samfile = 1;
-    goto __pyx_L4;
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 1;
+    goto __pyx_L7;
   }
   /*else*/ {
 
@@ -34479,7 +32340,7 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
  *             self.owns_samfile = False
  * 
  */
-    __pyx_v_self->fp = __pyx_v_samfile->samfile;
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
     /* "csamtools.pyx":3802
  *         else:
@@ -34488,9 +32349,9 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
  * 
  *         assert samfile.isbam, "can only IndexReads on bam files"
  */
-    __pyx_v_self->owns_samfile = 0;
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 0;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
   /* "csamtools.pyx":3804
  *             self.owns_samfile = False
@@ -34521,18 +32382,6 @@ static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtoo
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_12IndexedReads_3build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_9csamtools_12IndexedReads_2build[] = "IndexedReads.build(self)\nbuild index.";
-static PyObject *__pyx_pw_9csamtools_12IndexedReads_3build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("build (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_12IndexedReads_2build(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3806
  *         assert samfile.isbam, "can only IndexReads on bam files"
  * 
@@ -34541,7 +32390,9 @@ static PyObject *__pyx_pw_9csamtools_12IndexedReads_3build(PyObject *__pyx_v_sel
  * 
  */
 
-static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self) {
+static PyObject *__pyx_pf_9csamtools_12IndexedReads_1build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_9csamtools_12IndexedReads_1build[] = "IndexedReads.build(self)\nbuild index.";
+static PyObject *__pyx_pf_9csamtools_12IndexedReads_1build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
   int __pyx_v_ret;
   bam1_t *__pyx_v_b;
   uint64_t __pyx_v_pos;
@@ -34556,7 +32407,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csa
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("build", 0);
+  __Pyx_RefNannySetupContext("build");
   __Pyx_TraceCall("build", __pyx_f[0], 3806);
 
   /* "csamtools.pyx":3809
@@ -34572,7 +32423,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csa
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)((PyObject*)(&PyList_Type))));
   PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyList_Type))));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyList_Type))));
@@ -34581,9 +32432,9 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csa
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_GIVEREF(__pyx_t_3);
-  __Pyx_GOTREF(__pyx_v_self->index);
-  __Pyx_DECREF(__pyx_v_self->index);
-  __pyx_v_self->index = __pyx_t_3;
+  __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index);
+  __Pyx_DECREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index);
+  ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index = __pyx_t_3;
   __pyx_t_3 = 0;
 
   /* "csamtools.pyx":3813
@@ -34622,7 +32473,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csa
  *             ret = samread( self.fp, b)
  *             if ret > 0:
  */
-    __pyx_v_pos = bam_tell(__pyx_v_self->fp->x.bam);
+    __pyx_v_pos = bam_tell(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp->x.bam);
 
     /* "csamtools.pyx":3820
  *         while ret > 0:
@@ -34631,7 +32482,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csa
  *             if ret > 0:
  *                 qname = _charptr_to_str(bam1_qname( b ))
  */
-    __pyx_v_ret = samread(__pyx_v_self->fp, __pyx_v_b);
+    __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp, __pyx_v_b);
 
     /* "csamtools.pyx":3821
  *             pos = bam_tell( self.fp.x.bam )
@@ -34663,7 +32514,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csa
  * 
  *         bam_destroy1( b )
  */
-      __pyx_t_3 = PyObject_GetItem(__pyx_v_self->index, __pyx_v_qname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_1 = __Pyx_PyInt_to_py_uint64_t(__pyx_v_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
@@ -34672,9 +32523,9 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csa
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      goto __pyx_L5;
+      goto __pyx_L7;
     }
-    __pyx_L5:;
+    __pyx_L7:;
   }
 
   /* "csamtools.pyx":3825
@@ -34702,18 +32553,6 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_9csamtools_12IndexedReads_5find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
-static char __pyx_doc_9csamtools_12IndexedReads_4find[] = "IndexedReads.find(self, qname)";
-static PyObject *__pyx_pw_9csamtools_12IndexedReads_5find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("find (wrapper)", 0);
-  __pyx_r = __pyx_pf_9csamtools_12IndexedReads_4find(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self), ((PyObject *)__pyx_v_qname));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
 /* "csamtools.pyx":3827
  *         bam_destroy1( b )
  * 
@@ -34722,7 +32561,9 @@ static PyObject *__pyx_pw_9csamtools_12IndexedReads_5find(PyObject *__pyx_v_self
  *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
  */
 
-static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self, PyObject *__pyx_v_qname) {
+static PyObject *__pyx_pf_9csamtools_12IndexedReads_2find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
+static char __pyx_doc_9csamtools_12IndexedReads_2find[] = "IndexedReads.find(self, qname)";
+static PyObject *__pyx_pf_9csamtools_12IndexedReads_2find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -34733,7 +32574,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csam
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("find", 0);
+  __Pyx_RefNannySetupContext("find");
   __Pyx_TraceCall("find", __pyx_f[0], 3827);
 
   /* "csamtools.pyx":3828
@@ -34743,7 +32584,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csam
  *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
  *         else:
  */
-  __pyx_t_1 = ((PySequence_Contains(__pyx_v_self->index, __pyx_v_qname))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
 
     /* "csamtools.pyx":3829
@@ -34754,13 +32595,13 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csam
  *             raise KeyError( "read %s not found" % qname )
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyObject_GetItem(__pyx_v_self->index, __pyx_v_qname); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->samfile));
-    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
+    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
+    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
     __Pyx_GIVEREF(__pyx_t_2);
     __pyx_t_2 = 0;
@@ -34770,14 +32611,14 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csam
     __Pyx_GOTREF(__pyx_t_4);
     if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowSelection)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowSelection)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __pyx_r = __pyx_t_4;
     __pyx_t_4 = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
   /*else*/ {
 
@@ -34791,7 +32632,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csam
     __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_186), __pyx_v_qname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
     __pyx_t_4 = 0;
@@ -34802,7 +32643,7 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csam
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -34819,15 +32660,6 @@ static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csam
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_9csamtools_12IndexedReads_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_9csamtools_12IndexedReads_7__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_9csamtools_12IndexedReads_6__dealloc__(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
 /* "csamtools.pyx":3833
  *             raise KeyError( "read %s not found" % qname )
  * 
@@ -34836,10 +32668,11 @@ static void __pyx_pw_9csamtools_12IndexedReads_7__dealloc__(PyObject *__pyx_v_se
  * 
  */
 
-static void __pyx_pf_9csamtools_12IndexedReads_6__dealloc__(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self) {
+static void __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(PyObject *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__", 0);
+  __Pyx_RefNannySetupContext("__dealloc__");
   __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3833);
 
   /* "csamtools.pyx":3834
@@ -34849,11 +32682,11 @@ static void __pyx_pf_9csamtools_12IndexedReads_6__dealloc__(struct __pyx_obj_9cs
  * 
  * __all__ = ["Samfile",
  */
-  if (__pyx_v_self->owns_samfile) {
-    samclose(__pyx_v_self->fp);
-    goto __pyx_L3;
+  if (((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile) {
+    samclose(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp);
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
@@ -34866,7 +32699,7 @@ static PyObject *__pyx_tp_new_9csamtools_Fastafile(PyTypeObject *t, PyObject *a,
   if (!o) return 0;
   p = ((struct __pyx_obj_9csamtools_Fastafile *)o);
   p->__pyx_vtab = __pyx_vtabptr_9csamtools_Fastafile;
-  if (__pyx_pw_9csamtools_9Fastafile_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_9Fastafile___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -34877,7 +32710,7 @@ static void __pyx_tp_dealloc_9csamtools_Fastafile(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_9csamtools_9Fastafile_11__dealloc__(o);
+    __pyx_pf_9csamtools_9Fastafile_5__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -34886,14 +32719,14 @@ static void __pyx_tp_dealloc_9csamtools_Fastafile(PyObject *o) {
 }
 
 static PyObject *__pyx_getprop_9csamtools_9Fastafile_filename(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_9Fastafile_8filename_1__get__(o);
+  return __pyx_pf_9csamtools_9Fastafile_8filename___get__(o);
 }
 
 static PyMethodDef __pyx_methods_9csamtools_Fastafile[] = {
-  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_9csamtools_9Fastafile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_2_isOpen)},
-  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_9csamtools_9Fastafile_7_open, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_6_open)},
-  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_9csamtools_9Fastafile_9close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_8close)},
-  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_9csamtools_9Fastafile_13fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_12fetch)},
+  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_1_isOpen)},
+  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_3_open, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_3_open)},
+  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_4close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_4close)},
+  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_6fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_6fetch)},
   {0, 0, 0, 0}
 };
 
@@ -34961,7 +32794,7 @@ static PyNumberMethods __pyx_tp_as_number_Fastafile = {
 };
 
 static PySequenceMethods __pyx_tp_as_sequence_Fastafile = {
-  __pyx_pw_9csamtools_9Fastafile_5__len__, /*sq_length*/
+  __pyx_pf_9csamtools_9Fastafile_2__len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
   0, /*sq_item*/
@@ -34974,7 +32807,7 @@ static PySequenceMethods __pyx_tp_as_sequence_Fastafile = {
 };
 
 static PyMappingMethods __pyx_tp_as_mapping_Fastafile = {
-  __pyx_pw_9csamtools_9Fastafile_5__len__, /*mp_length*/
+  __pyx_pf_9csamtools_9Fastafile_2__len__, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
@@ -35067,7 +32900,7 @@ static void __pyx_tp_dealloc_9csamtools_AlignedRead(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_9csamtools_11AlignedRead_3__dealloc__(o);
+    __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -35076,12 +32909,12 @@ static void __pyx_tp_dealloc_9csamtools_AlignedRead(PyObject *o) {
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qname(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_5qname_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_5qname___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_5qname_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35090,12 +32923,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigar(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_5cigar_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_5cigar___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_5cigar_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35104,12 +32937,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigarstring(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_11cigarstring_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_cigarstring(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_11cigarstring_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_11cigarstring_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35118,12 +32951,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_cigarstring(PyObject *o, PyObj
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_seq(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_3seq_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_3seq___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_3seq_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35132,12 +32965,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qual(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4qual_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4qual___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_4qual_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35146,32 +32979,32 @@ static int __pyx_setprop_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_query(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_5query_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_5query___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qqual(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_5qqual_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_5qqual___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qstart(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_6qstart_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_6qstart___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qend(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4qend_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4qend___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qlen(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4qlen_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4qlen___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tags(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4tags_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4tags___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_4tags_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35180,12 +33013,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_flag(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4flag_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4flag___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_4flag_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35194,12 +33027,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rname(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_5rname_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_5rname___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_5rname_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35208,12 +33041,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tid(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_3tid_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_3tid___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_3tid_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35222,12 +33055,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pos(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_3pos_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_3pos___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_3pos_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35236,12 +33069,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_bin(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_3bin_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_3bin___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_3bin_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35250,24 +33083,24 @@ static int __pyx_setprop_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rlen(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4rlen_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4rlen___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aend(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4aend_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4aend___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_alen(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4alen_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4alen___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mapq(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4mapq_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4mapq___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_4mapq_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35276,12 +33109,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mrnm(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4mrnm_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_4mrnm_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35290,12 +33123,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rnext(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_5rnext_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_5rnext___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_rnext(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_5rnext_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35304,12 +33137,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_rnext(PyObject *o, PyObject *v
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mpos(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4mpos_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4mpos___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_4mpos_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35318,12 +33151,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pnext(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_5pnext_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_5pnext___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_pnext(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_5pnext_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35332,12 +33165,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_pnext(PyObject *o, PyObject *v
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_isize(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_5isize_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_5isize___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_5isize_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35346,12 +33179,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tlen(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_4tlen_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_4tlen___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_tlen(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_4tlen_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35360,12 +33193,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_tlen(PyObject *o, PyObject *v,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_paired(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_9is_paired_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_9is_paired_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35374,12 +33207,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObjec
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35388,12 +33221,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, Py
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35402,12 +33235,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObj
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35416,12 +33249,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o,
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_10is_reverse_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_10is_reverse_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35430,12 +33263,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObje
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35444,12 +33277,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, P
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read1(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_8is_read1_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_8is_read1_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35458,12 +33291,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read2(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_8is_read2_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_8is_read2_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35472,12 +33305,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_12is_secondary_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_12is_secondary_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35486,12 +33319,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyOb
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35500,12 +33333,12 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObjec
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35514,18 +33347,18 @@ static int __pyx_setprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyOb
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_positions(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_9positions_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_9positions___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aligned_pairs(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11AlignedRead_13aligned_pairs_1__get__(o);
+  return __pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(o);
 }
 
 static PyMethodDef __pyx_methods_9csamtools_AlignedRead[] = {
-  {__Pyx_NAMESTR("compare"), (PyCFunction)__pyx_pw_9csamtools_11AlignedRead_7compare, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_6compare)},
-  {__Pyx_NAMESTR("overlap"), (PyCFunction)__pyx_pw_9csamtools_11AlignedRead_11overlap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_10overlap)},
-  {__Pyx_NAMESTR("opt"), (PyCFunction)__pyx_pw_9csamtools_11AlignedRead_13opt, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_12opt)},
-  {__Pyx_NAMESTR("fancy_str"), (PyCFunction)__pyx_pw_9csamtools_11AlignedRead_15fancy_str, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_14fancy_str)},
+  {__Pyx_NAMESTR("compare"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_3compare, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_3compare)},
+  {__Pyx_NAMESTR("overlap"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_5overlap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_5overlap)},
+  {__Pyx_NAMESTR("opt"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_6opt, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_6opt)},
+  {__Pyx_NAMESTR("fancy_str"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_7fancy_str, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_7fancy_str)},
   {0, 0, 0, 0}
 };
 
@@ -35688,9 +33521,9 @@ static PyTypeObject __pyx_type_9csamtools_AlignedRead = {
   &__pyx_tp_as_number_AlignedRead, /*tp_as_number*/
   &__pyx_tp_as_sequence_AlignedRead, /*tp_as_sequence*/
   &__pyx_tp_as_mapping_AlignedRead, /*tp_as_mapping*/
-  __pyx_pw_9csamtools_11AlignedRead_9__hash__, /*tp_hash*/
+  __pyx_pf_9csamtools_11AlignedRead_4__hash__, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pw_9csamtools_11AlignedRead_5__str__, /*tp_str*/
+  __pyx_pf_9csamtools_11AlignedRead_2__str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_AlignedRead, /*tp_as_buffer*/
@@ -35710,7 +33543,7 @@ static PyTypeObject __pyx_type_9csamtools_AlignedRead = {
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_9csamtools_11AlignedRead_1__init__, /*tp_init*/
+  __pyx_pf_9csamtools_11AlignedRead___init__, /*tp_init*/
   0, /*tp_alloc*/
   __pyx_tp_new_9csamtools_AlignedRead, /*tp_new*/
   0, /*tp_free*/
@@ -35733,7 +33566,7 @@ static PyObject *__pyx_tp_new_9csamtools_Samfile(PyTypeObject *t, PyObject *a, P
   if (!o) return 0;
   p = ((struct __pyx_obj_9csamtools_Samfile *)o);
   p->__pyx_vtab = __pyx_vtabptr_9csamtools_Samfile;
-  if (__pyx_pw_9csamtools_7Samfile_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_7Samfile___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -35744,7 +33577,7 @@ static void __pyx_tp_dealloc_9csamtools_Samfile(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_9csamtools_7Samfile_31__dealloc__(o);
+    __pyx_pf_9csamtools_7Samfile_15__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -35753,57 +33586,57 @@ static void __pyx_tp_dealloc_9csamtools_Samfile(PyObject *o) {
 }
 
 static PyObject *__pyx_getprop_9csamtools_7Samfile_filename(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7Samfile_8filename_1__get__(o);
+  return __pyx_pf_9csamtools_7Samfile_8filename___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7Samfile_nreferences(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7Samfile_11nreferences_1__get__(o);
+  return __pyx_pf_9csamtools_7Samfile_11nreferences___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7Samfile_references(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7Samfile_10references_1__get__(o);
+  return __pyx_pf_9csamtools_7Samfile_10references___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7Samfile_lengths(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7Samfile_7lengths_1__get__(o);
+  return __pyx_pf_9csamtools_7Samfile_7lengths___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7Samfile_mapped(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7Samfile_6mapped_1__get__(o);
+  return __pyx_pf_9csamtools_7Samfile_6mapped___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7Samfile_unmapped(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7Samfile_8unmapped_1__get__(o);
+  return __pyx_pf_9csamtools_7Samfile_8unmapped___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7Samfile_text(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7Samfile_4text_1__get__(o);
+  return __pyx_pf_9csamtools_7Samfile_4text___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7Samfile_header(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7Samfile_6header_1__get__(o);
+  return __pyx_pf_9csamtools_7Samfile_6header___get__(o);
 }
 
 static PyMethodDef __pyx_methods_9csamtools_Samfile[] = {
-  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_2_isOpen)},
-  {__Pyx_NAMESTR("_hasIndex"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_5_hasIndex, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_4_hasIndex)},
-  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_7_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_6_open)},
-  {__Pyx_NAMESTR("gettid"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_9gettid, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_8gettid)},
-  {__Pyx_NAMESTR("getrname"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_11getrname, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_10getrname)},
-  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_13_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_12_parseRegion)},
-  {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_15reset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_14reset)},
-  {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_17seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_16seek)},
-  {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_19tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_18tell)},
-  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_21fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_20fetch)},
-  {__Pyx_NAMESTR("mate"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_23mate, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_22mate)},
-  {__Pyx_NAMESTR("count"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_25count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_24count)},
-  {__Pyx_NAMESTR("pileup"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_27pileup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_26pileup)},
-  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_29close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_28close)},
-  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_33write, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_32write)},
-  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_35__enter__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_34__enter__)},
-  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_37__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_36__exit__)},
-  {__Pyx_NAMESTR("_buildLine"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_39_buildLine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_38_buildLine)},
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_43__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_42__next__)},
+  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_1_isOpen)},
+  {__Pyx_NAMESTR("_hasIndex"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_2_hasIndex, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_2_hasIndex)},
+  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_3_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_3_open)},
+  {__Pyx_NAMESTR("gettid"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_4gettid, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_4gettid)},
+  {__Pyx_NAMESTR("getrname"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_5getrname, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_5getrname)},
+  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_6_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_6_parseRegion)},
+  {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_7reset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_7reset)},
+  {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_8seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_8seek)},
+  {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_9tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_9tell)},
+  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_10fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_10fetch)},
+  {__Pyx_NAMESTR("mate"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_11mate, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_11mate)},
+  {__Pyx_NAMESTR("count"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_12count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_12count)},
+  {__Pyx_NAMESTR("pileup"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_13pileup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_13pileup)},
+  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_14close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_14close)},
+  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_16write, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_16write)},
+  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_17__enter__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_17__enter__)},
+  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_18__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_18__exit__)},
+  {__Pyx_NAMESTR("_buildLine"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_19_buildLine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_19_buildLine)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_21__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_21__next__)},
   {0, 0, 0, 0}
 };
 
@@ -35947,8 +33780,8 @@ static PyTypeObject __pyx_type_9csamtools_Samfile = {
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_9csamtools_7Samfile_41__iter__, /*tp_iter*/
-  __pyx_pw_9csamtools_7Samfile_43__next__, /*tp_iternext*/
+  __pyx_pf_9csamtools_7Samfile_20__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_7Samfile_21__next__, /*tp_iternext*/
   __pyx_methods_9csamtools_Samfile, /*tp_methods*/
   0, /*tp_members*/
   __pyx_getsets_9csamtools_Samfile, /*tp_getset*/
@@ -35984,16 +33817,16 @@ static void __pyx_tp_dealloc_9csamtools_PileupProxy(PyObject *o) {
 }
 
 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_tid(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11PileupProxy_3tid_1__get__(o);
+  return __pyx_pf_9csamtools_11PileupProxy_3tid___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_n(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11PileupProxy_1n_1__get__(o);
+  return __pyx_pf_9csamtools_11PileupProxy_1n___get__(o);
 }
 
 static int __pyx_setprop_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_9csamtools_11PileupProxy_1n_3__set__(o, v);
+    return __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -36002,11 +33835,11 @@ static int __pyx_setprop_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, vo
 }
 
 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pos(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11PileupProxy_3pos_1__get__(o);
+  return __pyx_pf_9csamtools_11PileupProxy_3pos___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pileups(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_11PileupProxy_7pileups_1__get__(o);
+  return __pyx_pf_9csamtools_11PileupProxy_7pileups___get__(o);
 }
 
 static PyMethodDef __pyx_methods_9csamtools_PileupProxy[] = {
@@ -36139,7 +33972,7 @@ static PyTypeObject __pyx_type_9csamtools_PileupProxy = {
   &__pyx_tp_as_mapping_PileupProxy, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pw_9csamtools_11PileupProxy_3__str__, /*tp_str*/
+  __pyx_pf_9csamtools_11PileupProxy_1__str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_PileupProxy, /*tp_as_buffer*/
@@ -36159,7 +33992,7 @@ static PyTypeObject __pyx_type_9csamtools_PileupProxy = {
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_9csamtools_11PileupProxy_1__init__, /*tp_init*/
+  __pyx_pf_9csamtools_11PileupProxy___init__, /*tp_init*/
   0, /*tp_alloc*/
   __pyx_tp_new_9csamtools_PileupProxy, /*tp_new*/
   0, /*tp_free*/
@@ -36209,31 +34042,31 @@ static int __pyx_tp_clear_9csamtools_PileupRead(PyObject *o) {
 }
 
 static PyObject *__pyx_getprop_9csamtools_10PileupRead_alignment(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_10PileupRead_9alignment_1__get__(o);
+  return __pyx_pf_9csamtools_10PileupRead_9alignment___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_10PileupRead_qpos(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_10PileupRead_4qpos_1__get__(o);
+  return __pyx_pf_9csamtools_10PileupRead_4qpos___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_10PileupRead_indel(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_10PileupRead_5indel_1__get__(o);
+  return __pyx_pf_9csamtools_10PileupRead_5indel___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_del(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_10PileupRead_6is_del_1__get__(o);
+  return __pyx_pf_9csamtools_10PileupRead_6is_del___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_head(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_10PileupRead_7is_head_1__get__(o);
+  return __pyx_pf_9csamtools_10PileupRead_7is_head___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_tail(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_10PileupRead_7is_tail_1__get__(o);
+  return __pyx_pf_9csamtools_10PileupRead_7is_tail___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_10PileupRead_level(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_10PileupRead_5level_1__get__(o);
+  return __pyx_pf_9csamtools_10PileupRead_5level___get__(o);
 }
 
 static PyMethodDef __pyx_methods_9csamtools_PileupRead[] = {
@@ -36369,7 +34202,7 @@ static PyTypeObject __pyx_type_9csamtools_PileupRead = {
   &__pyx_tp_as_mapping_PileupRead, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pw_9csamtools_10PileupRead_3__str__, /*tp_str*/
+  __pyx_pf_9csamtools_10PileupRead_1__str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_PileupRead, /*tp_as_buffer*/
@@ -36389,7 +34222,7 @@ static PyTypeObject __pyx_type_9csamtools_PileupRead = {
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_9csamtools_10PileupRead_1__init__, /*tp_init*/
+  __pyx_pf_9csamtools_10PileupRead___init__, /*tp_init*/
   0, /*tp_alloc*/
   __pyx_tp_new_9csamtools_PileupRead, /*tp_new*/
   0, /*tp_free*/
@@ -36581,7 +34414,7 @@ static PyObject *__pyx_tp_new_9csamtools_IteratorRowRegion(PyTypeObject *t, PyOb
   p = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)o);
   p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowRegion;
   p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_17IteratorRowRegion___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -36593,7 +34426,7 @@ static void __pyx_tp_dealloc_9csamtools_IteratorRowRegion(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_9csamtools_17IteratorRowRegion_7__dealloc__(o);
+    __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -36627,7 +34460,7 @@ static int __pyx_tp_clear_9csamtools_IteratorRowRegion(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IteratorRowRegion[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_17IteratorRowRegion_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_17IteratorRowRegion_4__next__)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_17IteratorRowRegion_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_17IteratorRowRegion_2__next__)},
   {0, 0, 0, 0}
 };
 
@@ -36759,8 +34592,8 @@ static PyTypeObject __pyx_type_9csamtools_IteratorRowRegion = {
   __pyx_tp_clear_9csamtools_IteratorRowRegion, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_9csamtools_17IteratorRowRegion_3__iter__, /*tp_iter*/
-  __pyx_pw_9csamtools_17IteratorRowRegion_5__next__, /*tp_iternext*/
+  __pyx_pf_9csamtools_17IteratorRowRegion_1__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_17IteratorRowRegion_2__next__, /*tp_iternext*/
   __pyx_methods_9csamtools_IteratorRowRegion, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -36792,7 +34625,7 @@ static PyObject *__pyx_tp_new_9csamtools_IteratorRowAll(PyTypeObject *t, PyObjec
   if (!o) return 0;
   p = ((struct __pyx_obj_9csamtools_IteratorRowAll *)o);
   p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowAll;
-  if (__pyx_pw_9csamtools_14IteratorRowAll_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_14IteratorRowAll___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -36803,7 +34636,7 @@ static void __pyx_tp_dealloc_9csamtools_IteratorRowAll(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_9csamtools_14IteratorRowAll_7__dealloc__(o);
+    __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -36812,7 +34645,7 @@ static void __pyx_tp_dealloc_9csamtools_IteratorRowAll(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IteratorRowAll[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_14IteratorRowAll_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorRowAll_4__next__)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_14IteratorRowAll_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorRowAll_2__next__)},
   {0, 0, 0, 0}
 };
 
@@ -36944,8 +34777,8 @@ static PyTypeObject __pyx_type_9csamtools_IteratorRowAll = {
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_9csamtools_14IteratorRowAll_3__iter__, /*tp_iter*/
-  __pyx_pw_9csamtools_14IteratorRowAll_5__next__, /*tp_iternext*/
+  __pyx_pf_9csamtools_14IteratorRowAll_1__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_14IteratorRowAll_2__next__, /*tp_iternext*/
   __pyx_methods_9csamtools_IteratorRowAll, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -36977,7 +34810,7 @@ static PyObject *__pyx_tp_new_9csamtools_IteratorRowAllRefs(PyTypeObject *t, PyO
   p = ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o);
   p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
   p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pw_9csamtools_18IteratorRowAllRefs_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -37021,8 +34854,8 @@ static int __pyx_tp_clear_9csamtools_IteratorRowAllRefs(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IteratorRowAllRefs[] = {
-  {__Pyx_NAMESTR("nextiter"), (PyCFunction)__pyx_pw_9csamtools_18IteratorRowAllRefs_3nextiter, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_2nextiter)},
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_6__next__)},
+  {__Pyx_NAMESTR("nextiter"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_1nextiter)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__)},
   {0, 0, 0, 0}
 };
 
@@ -37154,8 +34987,8 @@ static PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
   __pyx_tp_clear_9csamtools_IteratorRowAllRefs, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_9csamtools_18IteratorRowAllRefs_5__iter__, /*tp_iter*/
-  __pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__, /*tp_iternext*/
+  __pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__, /*tp_iternext*/
   __pyx_methods_9csamtools_IteratorRowAllRefs, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -37188,7 +35021,7 @@ static PyObject *__pyx_tp_new_9csamtools_IteratorRowSelection(PyTypeObject *t, P
   p = ((struct __pyx_obj_9csamtools_IteratorRowSelection *)o);
   p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowSelection;
   p->positions = Py_None; Py_INCREF(Py_None);
-  if (__pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_20IteratorRowSelection___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -37200,7 +35033,7 @@ static void __pyx_tp_dealloc_9csamtools_IteratorRowSelection(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_9csamtools_20IteratorRowSelection_7__dealloc__(o);
+    __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -37234,7 +35067,7 @@ static int __pyx_tp_clear_9csamtools_IteratorRowSelection(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IteratorRowSelection[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_20IteratorRowSelection_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorRowSelection_4__next__)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorRowSelection_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorRowSelection_2__next__)},
   {0, 0, 0, 0}
 };
 
@@ -37366,8 +35199,8 @@ static PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
   __pyx_tp_clear_9csamtools_IteratorRowSelection, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_9csamtools_20IteratorRowSelection_3__iter__, /*tp_iter*/
-  __pyx_pw_9csamtools_20IteratorRowSelection_5__next__, /*tp_iternext*/
+  __pyx_pf_9csamtools_20IteratorRowSelection_1__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_20IteratorRowSelection_2__next__, /*tp_iternext*/
   __pyx_methods_9csamtools_IteratorRowSelection, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -37403,7 +35236,7 @@ static PyObject *__pyx_tp_new_9csamtools_IteratorColumn(PyTypeObject *t, PyObjec
   p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
   p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
   p->stepper = Py_None; Py_INCREF(Py_None);
-  if (__pyx_pw_9csamtools_14IteratorColumn_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_14IteratorColumn___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -37415,7 +35248,7 @@ static void __pyx_tp_dealloc_9csamtools_IteratorColumn(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_9csamtools_14IteratorColumn_9__dealloc__(o);
+    __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -37464,12 +35297,12 @@ static int __pyx_tp_clear_9csamtools_IteratorColumn(PyObject *o) {
 }
 
 static PyObject *__pyx_getprop_9csamtools_14IteratorColumn_seq_len(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_14IteratorColumn_7seq_len_1__get__(o);
+  return __pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(o);
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IteratorColumn[] = {
-  {__Pyx_NAMESTR("addReference"), (PyCFunction)__pyx_pw_9csamtools_14IteratorColumn_5addReference, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_4addReference)},
-  {__Pyx_NAMESTR("hasReference"), (PyCFunction)__pyx_pw_9csamtools_14IteratorColumn_7hasReference, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_6hasReference)},
+  {__Pyx_NAMESTR("addReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_2addReference, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_2addReference)},
+  {__Pyx_NAMESTR("hasReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_3hasReference, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_3hasReference)},
   {0, 0, 0, 0}
 };
 
@@ -37606,7 +35439,7 @@ static PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
   __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_9csamtools_14IteratorColumn_3__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_14IteratorColumn_1__iter__, /*tp_iter*/
   0, /*tp_iternext*/
   __pyx_methods_9csamtools_IteratorColumn, /*tp_methods*/
   0, /*tp_members*/
@@ -37639,14 +35472,14 @@ static PyObject *__pyx_tp_new_9csamtools_IteratorColumnRegion(PyTypeObject *t, P
   if (!o) return 0;
   p = ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnRegion;
-  if (__pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IteratorColumnRegion[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_20IteratorColumnRegion_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorColumnRegion_2__next__)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorColumnRegion_1__next__)},
   {0, 0, 0, 0}
 };
 
@@ -37779,7 +35612,7 @@ static PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = {
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
-  __pyx_pw_9csamtools_20IteratorColumnRegion_3__next__, /*tp_iternext*/
+  __pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, /*tp_iternext*/
   __pyx_methods_9csamtools_IteratorColumnRegion, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -37811,14 +35644,14 @@ static PyObject *__pyx_tp_new_9csamtools_IteratorColumnAllRefs(PyTypeObject *t,
   if (!o) return 0;
   p = ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
-  if (__pyx_pw_9csamtools_21IteratorColumnAllRefs_1__cinit__(o, a, k) < 0) {
+  if (__pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IteratorColumnAllRefs[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_21IteratorColumnAllRefs_2__next__)},
+  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__)},
   {0, 0, 0, 0}
 };
 
@@ -37951,7 +35784,7 @@ static PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = {
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
-  __pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__, /*tp_iternext*/
+  __pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, /*tp_iternext*/
   __pyx_methods_9csamtools_IteratorColumnAllRefs, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
@@ -37992,7 +35825,7 @@ static void __pyx_tp_dealloc_9csamtools_IndexedReads(PyObject *o) {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_9csamtools_12IndexedReads_7__dealloc__(o);
+    __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
@@ -38027,8 +35860,8 @@ static int __pyx_tp_clear_9csamtools_IndexedReads(PyObject *o) {
 }
 
 static PyMethodDef __pyx_methods_9csamtools_IndexedReads[] = {
-  {__Pyx_NAMESTR("build"), (PyCFunction)__pyx_pw_9csamtools_12IndexedReads_3build, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_2build)},
-  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pw_9csamtools_12IndexedReads_5find, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_4find)},
+  {__Pyx_NAMESTR("build"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_1build, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_1build)},
+  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_2find, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_2find)},
   {0, 0, 0, 0}
 };
 
@@ -38170,7 +36003,7 @@ static PyTypeObject __pyx_type_9csamtools_IndexedReads = {
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_9csamtools_12IndexedReads_1__init__, /*tp_init*/
+  __pyx_pf_9csamtools_12IndexedReads___init__, /*tp_init*/
   0, /*tp_alloc*/
   __pyx_tp_new_9csamtools_IndexedReads, /*tp_new*/
   0, /*tp_free*/
@@ -38197,35 +36030,35 @@ static void __pyx_tp_dealloc_9csamtools_SNPCall(PyObject *o) {
 }
 
 static PyObject *__pyx_getprop_9csamtools_7SNPCall_tid(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7SNPCall_3tid_1__get__(o);
+  return __pyx_pf_9csamtools_7SNPCall_3tid___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7SNPCall_pos(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7SNPCall_3pos_1__get__(o);
+  return __pyx_pf_9csamtools_7SNPCall_3pos___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7SNPCall_reference_base(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7SNPCall_14reference_base_1__get__(o);
+  return __pyx_pf_9csamtools_7SNPCall_14reference_base___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7SNPCall_genotype(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7SNPCall_8genotype_1__get__(o);
+  return __pyx_pf_9csamtools_7SNPCall_8genotype___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7SNPCall_consensus_quality(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7SNPCall_17consensus_quality_1__get__(o);
+  return __pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7SNPCall_snp_quality(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7SNPCall_11snp_quality_1__get__(o);
+  return __pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7SNPCall_mapping_quality(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7SNPCall_15mapping_quality_1__get__(o);
+  return __pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(o);
 }
 
 static PyObject *__pyx_getprop_9csamtools_7SNPCall_coverage(PyObject *o, void *x) {
-  return __pyx_pw_9csamtools_7SNPCall_8coverage_1__get__(o);
+  return __pyx_pf_9csamtools_7SNPCall_8coverage___get__(o);
 }
 
 static PyMethodDef __pyx_methods_9csamtools_SNPCall[] = {
@@ -38362,7 +36195,7 @@ static PyTypeObject __pyx_type_9csamtools_SNPCall = {
   &__pyx_tp_as_mapping_SNPCall, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pw_9csamtools_7SNPCall_1__str__, /*tp_str*/
+  __pyx_pf_9csamtools_7SNPCall___str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_SNPCall, /*tp_as_buffer*/
@@ -38398,9 +36231,219 @@ static PyTypeObject __pyx_type_9csamtools_SNPCall = {
   #endif
 };
 
+static PyObject *__pyx_tp_new_9csamtools___pyx_Generator(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_Generator_object *p;
+  PyObject *o = (*t->tp_alloc)(t, 0);
+  if (!o) return 0;
+  p = ((struct __pyx_Generator_object *)o);
+  p->exc_type = 0;
+  p->exc_value = 0;
+  p->exc_traceback = 0;
+  return o;
+}
+
+static void __pyx_tp_dealloc_9csamtools___pyx_Generator(PyObject *o) {
+  struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o;
+  Py_XDECREF(p->exc_type);
+  Py_XDECREF(p->exc_value);
+  Py_XDECREF(p->exc_traceback);
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_9csamtools___pyx_Generator(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o;
+  if (p->exc_type) {
+    e = (*v)(p->exc_type, a); if (e) return e;
+  }
+  if (p->exc_value) {
+    e = (*v)(p->exc_value, a); if (e) return e;
+  }
+  if (p->exc_traceback) {
+    e = (*v)(p->exc_traceback, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_9csamtools___pyx_Generator(PyObject *o) {
+  struct __pyx_Generator_object *p = (struct __pyx_Generator_object *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->exc_type);
+  p->exc_type = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->exc_value);
+  p->exc_value = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->exc_traceback);
+  p->exc_traceback = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyMethodDef __pyx_methods_9csamtools___pyx_Generator[] = {
+  {__Pyx_NAMESTR("send"), (PyCFunction)__Pyx_Generator_Send, METH_O, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("close"), (PyCFunction)__Pyx_Generator_Close, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("throw"), (PyCFunction)__Pyx_Generator_Throw, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+  {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_Generator = {
+  0, /*nb_add*/
+  0, /*nb_subtract*/
+  0, /*nb_multiply*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_divide*/
+  #endif
+  0, /*nb_remainder*/
+  0, /*nb_divmod*/
+  0, /*nb_power*/
+  0, /*nb_negative*/
+  0, /*nb_positive*/
+  0, /*nb_absolute*/
+  0, /*nb_nonzero*/
+  0, /*nb_invert*/
+  0, /*nb_lshift*/
+  0, /*nb_rshift*/
+  0, /*nb_and*/
+  0, /*nb_xor*/
+  0, /*nb_or*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_coerce*/
+  #endif
+  0, /*nb_int*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_long*/
+  #else
+  0, /*reserved*/
+  #endif
+  0, /*nb_float*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_oct*/
+  #endif
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_hex*/
+  #endif
+  0, /*nb_inplace_add*/
+  0, /*nb_inplace_subtract*/
+  0, /*nb_inplace_multiply*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_inplace_divide*/
+  #endif
+  0, /*nb_inplace_remainder*/
+  0, /*nb_inplace_power*/
+  0, /*nb_inplace_lshift*/
+  0, /*nb_inplace_rshift*/
+  0, /*nb_inplace_and*/
+  0, /*nb_inplace_xor*/
+  0, /*nb_inplace_or*/
+  0, /*nb_floor_divide*/
+  0, /*nb_true_divide*/
+  0, /*nb_inplace_floor_divide*/
+  0, /*nb_inplace_true_divide*/
+  #if PY_VERSION_HEX >= 0x02050000
+  0, /*nb_index*/
+  #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence___pyx_Generator = {
+  0, /*sq_length*/
+  0, /*sq_concat*/
+  0, /*sq_repeat*/
+  0, /*sq_item*/
+  0, /*sq_slice*/
+  0, /*sq_ass_item*/
+  0, /*sq_ass_slice*/
+  0, /*sq_contains*/
+  0, /*sq_inplace_concat*/
+  0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping___pyx_Generator = {
+  0, /*mp_length*/
+  0, /*mp_subscript*/
+  0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_Generator = {
+  #if PY_MAJOR_VERSION < 3
+  0, /*bf_getreadbuffer*/
+  #endif
+  #if PY_MAJOR_VERSION < 3
+  0, /*bf_getwritebuffer*/
+  #endif
+  #if PY_MAJOR_VERSION < 3
+  0, /*bf_getsegcount*/
+  #endif
+  #if PY_MAJOR_VERSION < 3
+  0, /*bf_getcharbuffer*/
+  #endif
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*bf_getbuffer*/
+  #endif
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*bf_releasebuffer*/
+  #endif
+};
+
+static PyTypeObject __pyx_Generator_type = {
+  PyVarObject_HEAD_INIT(0, 0)
+  __Pyx_NAMESTR("csamtools.__pyx_Generator"), /*tp_name*/
+  sizeof(struct __pyx_Generator_object), /*tp_basicsize*/
+  0, /*tp_itemsize*/
+  __pyx_tp_dealloc_9csamtools___pyx_Generator, /*tp_dealloc*/
+  0, /*tp_print*/
+  0, /*tp_getattr*/
+  0, /*tp_setattr*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*tp_compare*/
+  #else
+  0, /*reserved*/
+  #endif
+  0, /*tp_repr*/
+  &__pyx_tp_as_number___pyx_Generator, /*tp_as_number*/
+  &__pyx_tp_as_sequence___pyx_Generator, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping___pyx_Generator, /*tp_as_mapping*/
+  0, /*tp_hash*/
+  0, /*tp_call*/
+  0, /*tp_str*/
+  0, /*tp_getattro*/
+  0, /*tp_setattro*/
+  &__pyx_tp_as_buffer___pyx_Generator, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_doc*/
+  __pyx_tp_traverse_9csamtools___pyx_Generator, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools___pyx_Generator, /*tp_clear*/
+  0, /*tp_richcompare*/
+  0, /*tp_weaklistoffset*/
+  PyObject_SelfIter, /*tp_iter*/
+  __Pyx_Generator_Next, /*tp_iternext*/
+  __pyx_methods_9csamtools___pyx_Generator, /*tp_methods*/
+  0, /*tp_members*/
+  0, /*tp_getset*/
+  0, /*tp_base*/
+  0, /*tp_dict*/
+  0, /*tp_descr_get*/
+  0, /*tp_descr_set*/
+  0, /*tp_dictoffset*/
+  0, /*tp_init*/
+  0, /*tp_alloc*/
+  __pyx_tp_new_9csamtools___pyx_Generator, /*tp_new*/
+  0, /*tp_free*/
+  0, /*tp_is_gc*/
+  0, /*tp_bases*/
+  0, /*tp_mro*/
+  0, /*tp_cache*/
+  0, /*tp_subclasses*/
+  0, /*tp_weaklist*/
+  0, /*tp_del*/
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*tp_version_tag*/
+  #endif
+};
+
 static PyObject *__pyx_tp_new_9csamtools___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
+  PyObject *o = __pyx_tp_new_9csamtools___pyx_Generator(t, a, k);
   if (!o) return 0;
   p = ((struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)o);
   p->__pyx_v_x = 0;
@@ -38416,12 +36459,13 @@ static void __pyx_tp_dealloc_9csamtools___pyx_scope_struct__genexpr(PyObject *o)
   Py_XDECREF(p->__pyx_v_y);
   Py_XDECREF(p->__pyx_t_0);
   Py_XDECREF(p->__pyx_t_1);
-  (*Py_TYPE(o)->tp_free)(o);
+  __pyx_tp_dealloc_9csamtools___pyx_Generator(o);
 }
 
 static int __pyx_tp_traverse_9csamtools___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
   int e;
   struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)o;
+  e = __pyx_tp_traverse_9csamtools___pyx_Generator(o, v, a); if (e) return e;
   if (p->__pyx_v_x) {
     e = (*v)(p->__pyx_v_x, a); if (e) return e;
   }
@@ -38440,6 +36484,7 @@ static int __pyx_tp_traverse_9csamtools___pyx_scope_struct__genexpr(PyObject *o,
 static int __pyx_tp_clear_9csamtools___pyx_scope_struct__genexpr(PyObject *o) {
   struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)o;
   PyObject* tmp;
+  __pyx_tp_clear_9csamtools___pyx_Generator(o);
   tmp = ((PyObject*)p->__pyx_v_x);
   p->__pyx_v_x = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
@@ -38615,7 +36660,7 @@ static PyTypeObject __pyx_type_9csamtools___pyx_scope_struct__genexpr = {
 
 static PyObject *__pyx_tp_new_9csamtools___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
+  PyObject *o = __pyx_tp_new_9csamtools___pyx_Generator(t, a, k);
   if (!o) return 0;
   p = ((struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)o);
   p->__pyx_v_x = 0;
@@ -38631,12 +36676,13 @@ static void __pyx_tp_dealloc_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o
   Py_XDECREF(p->__pyx_v_y);
   Py_XDECREF(p->__pyx_t_0);
   Py_XDECREF(p->__pyx_t_1);
-  (*Py_TYPE(o)->tp_free)(o);
+  __pyx_tp_dealloc_9csamtools___pyx_Generator(o);
 }
 
 static int __pyx_tp_traverse_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
   int e;
   struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)o;
+  e = __pyx_tp_traverse_9csamtools___pyx_Generator(o, v, a); if (e) return e;
   if (p->__pyx_v_x) {
     e = (*v)(p->__pyx_v_x, a); if (e) return e;
   }
@@ -38655,6 +36701,7 @@ static int __pyx_tp_traverse_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o
 static int __pyx_tp_clear_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o) {
   struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)o;
   PyObject* tmp;
+  __pyx_tp_clear_9csamtools___pyx_Generator(o);
   tmp = ((PyObject*)p->__pyx_v_x);
   p->__pyx_v_x = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
@@ -38913,12 +36960,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
   {&__pyx_n_s_249, __pyx_k_249, sizeof(__pyx_k_249), 0, 0, 1, 1},
   {&__pyx_kp_s_251, __pyx_k_251, sizeof(__pyx_k_251), 0, 0, 1, 0},
+  {&__pyx_kp_s_254, __pyx_k_254, sizeof(__pyx_k_254), 0, 0, 1, 0},
+  {&__pyx_kp_s_255, __pyx_k_255, sizeof(__pyx_k_255), 0, 0, 1, 0},
   {&__pyx_kp_s_256, __pyx_k_256, sizeof(__pyx_k_256), 0, 0, 1, 0},
-  {&__pyx_kp_s_257, __pyx_k_257, sizeof(__pyx_k_257), 0, 0, 1, 0},
-  {&__pyx_kp_s_266, __pyx_k_266, sizeof(__pyx_k_266), 0, 0, 1, 0},
-  {&__pyx_kp_s_273, __pyx_k_273, sizeof(__pyx_k_273), 0, 0, 1, 0},
+  {&__pyx_kp_s_262, __pyx_k_262, sizeof(__pyx_k_262), 0, 0, 1, 0},
   {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
-  {&__pyx_kp_s_290, __pyx_k_290, sizeof(__pyx_k_290), 0, 0, 1, 0},
   {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
   {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
   {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
@@ -39004,6 +37050,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__PI, __pyx_k__PI, sizeof(__pyx_k__PI), 0, 0, 1, 1},
   {&__pyx_n_s__PL, __pyx_k__PL, sizeof(__pyx_k__PL), 0, 0, 1, 1},
   {&__pyx_n_s__PN, __pyx_k__PN, sizeof(__pyx_k__PN), 0, 0, 1, 1},
+  {&__pyx_n_s__PP, __pyx_k__PP, sizeof(__pyx_k__PP), 0, 0, 1, 1},
   {&__pyx_n_s__PU, __pyx_k__PU, sizeof(__pyx_k__PU), 0, 0, 1, 1},
   {&__pyx_n_s__PileupColumn, __pyx_k__PileupColumn, sizeof(__pyx_k__PileupColumn), 0, 0, 1, 1},
   {&__pyx_n_s__PileupProxy, __pyx_k__PileupProxy, sizeof(__pyx_k__PileupProxy), 0, 0, 1, 1},
@@ -39046,7 +37093,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1},
   {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1},
   {&__pyx_n_s___samtools_dispatch, __pyx_k___samtools_dispatch, sizeof(__pyx_k___samtools_dispatch), 0, 0, 1, 1},
-  {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
   {&__pyx_n_s__add_sq_text, __pyx_k__add_sq_text, sizeof(__pyx_k__add_sq_text), 0, 0, 1, 1},
   {&__pyx_n_s__alignment, __pyx_k__alignment, sizeof(__pyx_k__alignment), 0, 0, 1, 1},
   {&__pyx_n_s__all, __pyx_k__all, sizeof(__pyx_k__all), 0, 0, 1, 1},
@@ -39059,7 +37105,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
   {&__pyx_n_s__calcsize, __pyx_k__calcsize, sizeof(__pyx_k__calcsize), 0, 0, 1, 1},
   {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1},
-  {&__pyx_n_s__cargs, __pyx_k__cargs, sizeof(__pyx_k__cargs), 0, 0, 1, 1},
   {&__pyx_n_s__catch_stdout, __pyx_k__catch_stdout, sizeof(__pyx_k__catch_stdout), 0, 0, 1, 1},
   {&__pyx_n_s__check_header, __pyx_k__check_header, sizeof(__pyx_k__check_header), 0, 0, 1, 1},
   {&__pyx_n_s__check_sq, __pyx_k__check_sq, sizeof(__pyx_k__check_sq), 0, 0, 1, 1},
@@ -39103,7 +37148,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
   {&__pyx_n_s__indel, __pyx_k__indel, sizeof(__pyx_k__indel), 0, 0, 1, 1},
   {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
-  {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1},
   {&__pyx_n_s__is_del, __pyx_k__is_del, sizeof(__pyx_k__is_del), 0, 0, 1, 1},
   {&__pyx_n_s__is_head, __pyx_k__is_head, sizeof(__pyx_k__is_head), 0, 0, 1, 1},
   {&__pyx_n_s__is_tail, __pyx_k__is_tail, sizeof(__pyx_k__is_tail), 0, 0, 1, 1},
@@ -39137,13 +37181,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__nextiter, __pyx_k__nextiter, sizeof(__pyx_k__nextiter), 0, 0, 1, 1},
   {&__pyx_n_s__nreferences, __pyx_k__nreferences, sizeof(__pyx_k__nreferences), 0, 0, 1, 1},
   {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
-  {&__pyx_n_s__ofd, __pyx_k__ofd, sizeof(__pyx_k__ofd), 0, 0, 1, 1},
   {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1},
   {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
   {&__pyx_n_s__ord, __pyx_k__ord, sizeof(__pyx_k__ord), 0, 0, 1, 1},
   {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
-  {&__pyx_n_s__out_stderr, __pyx_k__out_stderr, sizeof(__pyx_k__out_stderr), 0, 0, 1, 1},
-  {&__pyx_n_s__out_stdout, __pyx_k__out_stdout, sizeof(__pyx_k__out_stdout), 0, 0, 1, 1},
   {&__pyx_n_s__pack_into, __pyx_k__pack_into, sizeof(__pyx_k__pack_into), 0, 0, 1, 1},
   {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
   {&__pyx_n_s__pileups, __pyx_k__pileups, sizeof(__pyx_k__pileups), 0, 0, 1, 1},
@@ -39176,7 +37217,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1},
   {&__pyx_n_s__reopen, __pyx_k__reopen, sizeof(__pyx_k__reopen), 0, 0, 1, 1},
   {&__pyx_n_s__restore, __pyx_k__restore, sizeof(__pyx_k__restore), 0, 0, 1, 1},
-  {&__pyx_n_s__retval, __pyx_k__retval, sizeof(__pyx_k__retval), 0, 0, 1, 1},
   {&__pyx_n_s__rlen, __pyx_k__rlen, sizeof(__pyx_k__rlen), 0, 0, 1, 1},
   {&__pyx_n_s__rname, __pyx_k__rname, sizeof(__pyx_k__rname), 0, 0, 1, 1},
   {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
@@ -39194,12 +37234,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
   {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
   {&__pyx_n_s__stderr, __pyx_k__stderr, sizeof(__pyx_k__stderr), 0, 0, 1, 1},
-  {&__pyx_n_s__stderr_f, __pyx_k__stderr_f, sizeof(__pyx_k__stderr_f), 0, 0, 1, 1},
-  {&__pyx_n_s__stderr_h, __pyx_k__stderr_h, sizeof(__pyx_k__stderr_h), 0, 0, 1, 1},
   {&__pyx_n_s__stdout, __pyx_k__stdout, sizeof(__pyx_k__stdout), 0, 0, 1, 1},
-  {&__pyx_n_s__stdout_f, __pyx_k__stdout_f, sizeof(__pyx_k__stdout_f), 0, 0, 1, 1},
-  {&__pyx_n_s__stdout_h, __pyx_k__stdout_h, sizeof(__pyx_k__stdout_h), 0, 0, 1, 1},
-  {&__pyx_n_s__stdout_save, __pyx_k__stdout_save, sizeof(__pyx_k__stdout_save), 0, 0, 1, 1},
   {&__pyx_n_s__stepper, __pyx_k__stepper, sizeof(__pyx_k__stepper), 0, 0, 1, 1},
   {&__pyx_n_s__streams, __pyx_k__streams, sizeof(__pyx_k__streams), 0, 0, 1, 1},
   {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1},
@@ -39256,7 +37291,7 @@ static int __Pyx_InitCachedBuiltins(void) {
 
 static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
 
   /* "csamtools.pyx":64
  *         return s
@@ -39266,7 +37301,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         raise TypeError, u"Argument must be string, bytes or unicode."
  */
   __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -39280,7 +37315,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         # assume unicode
  */
   __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_4);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -39294,7 +37329,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         return faidx_fetch_nseq(self.fastafile)
  */
   __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_8);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
   PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
@@ -39308,7 +37343,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_11);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39322,7 +37357,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         cdef int length
  */
   __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_12);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39336,7 +37371,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             if end is None: end = max_pos -1
  */
   __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_14);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
   PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
@@ -39350,7 +37385,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                              region,
  */
   __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_20);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -39364,7 +37399,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         #cfilename = filename.encode(_FILENAME_ENCODING)
  */
   __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_25);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -39378,7 +37413,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         return pysam_reference2tid( self.samfile.header, reference )
  */
   __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_39);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39392,7 +37427,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  */
   __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_40);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39406,7 +37441,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
  */
   __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_42);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_42));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39420,7 +37455,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         rtid = self.gettid( reference )
  */
   __pyx_k_tuple_44 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_44);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_44));
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
@@ -39443,7 +37478,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             raise NotImplementedError("seek only available in bam files")
  */
   __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_47);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39457,7 +37492,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             raise OSError("seek no available in streams")
  */
   __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_49);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
   PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_48));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
@@ -39471,7 +37506,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         return bam_seek( self.samfile.x.bam, offset, where )
  */
   __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_51);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
   PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_50));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
@@ -39485,7 +37520,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             raise NotImplementedError("seek only available in bam files")
  */
   __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_52);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_52));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39499,7 +37534,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         return bam_tell( self.samfile.x.bam )
  */
   __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_53);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
   PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_48));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
@@ -39513,7 +37548,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
   __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_55);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_55));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39527,7 +37562,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             if callback:
  */
   __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_57);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_57));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
   PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_kp_s_56));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
@@ -39541,7 +37576,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                 return bam_fetch(self.samfile.x.bam,
  */
   __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_59);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_59));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_58));
   PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_kp_s_58));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58));
@@ -39555,7 +37590,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                                  self.index,
  */
   __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_61);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_61));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
   PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_60));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
@@ -39569,7 +37604,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             if callback:
  */
   __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_63);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_63));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_62));
   PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_62));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_62));
@@ -39583,7 +37618,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             if self.samfile.header == NULL:
  */
   __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_65);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_65));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_64));
   PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_kp_s_64));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_64));
@@ -39597,7 +37632,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             # check if targets are defined
  */
   __pyx_k_tuple_67 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_67);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_66));
   PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_66));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_66));
@@ -39611,7 +37646,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             return IteratorRowAll( self, reopen=reopen )
  */
   __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_68);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_68));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_66));
   PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_kp_s_66));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_66));
@@ -39625,7 +37660,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  */
   __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_72);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_72));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_71));
   PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_71));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_71));
@@ -39639,7 +37674,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
   __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_74);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_74));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39653,7 +37688,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             if not region:
  */
   __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_75);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
   PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_56));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
@@ -39667,7 +37702,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             bam_fetch(self.samfile.x.bam,
  */
   __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_77);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_77));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_76));
   PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_kp_s_76));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_76));
@@ -39681,7 +37716,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                              self.index,
  */
   __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_78);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_78));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
   PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_kp_s_60));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
@@ -39695,7 +37730,7 @@ static int __Pyx_InitCachedConstants(void) {
  *     def pileup( self,
  */
   __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_80);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_80));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_79));
   PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_79));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_79));
@@ -39709,7 +37744,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  */
   __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_81);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_81));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39723,7 +37758,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             if callback:
  */
   __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_83);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_83));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_82));
   PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_82));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_82));
@@ -39737,7 +37772,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                 buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback )
  */
   __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_84);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_84));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_58));
   PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_s_58));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58));
@@ -39751,7 +37786,7 @@ static int __Pyx_InitCachedConstants(void) {
  *     def close( self ):
  */
   __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_86);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_86));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_85));
   PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_s_85));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85));
@@ -39765,7 +37800,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_87 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_87);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_87));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_87, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39779,7 +37814,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_88 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_88);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_88));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39793,7 +37828,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             for x from 0 <= x < self.samfile.header.n_targets:
  */
   __pyx_k_tuple_89 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_89);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_89));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_89, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39807,7 +37842,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             for x from 0 <= x < self.samfile.header.n_targets:
  */
   __pyx_k_tuple_90 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_90);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_90));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_90, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39821,7 +37856,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_91 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_91);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_91));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_91, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39835,7 +37870,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             cdef int tid
  */
   __pyx_k_tuple_93 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_93);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_93));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
   PyTuple_SET_ITEM(__pyx_k_tuple_93, 0, ((PyObject *)__pyx_kp_s_92));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
@@ -39849,7 +37884,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             cdef int tid
  */
   __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_94);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_94));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39863,7 +37898,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             cdef uint32_t total = 0
  */
   __pyx_k_tuple_96 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_96);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_96));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_95));
   PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, ((PyObject *)__pyx_kp_s_95));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_95));
@@ -39877,7 +37912,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_97 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_97);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_97));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_97, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39891,7 +37926,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             result = {}
  */
   __pyx_k_tuple_98 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_98);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_98));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_98, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -39905,7 +37940,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  */
   __pyx_k_tuple_99 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_99);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_99));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
   PyTuple_SET_ITEM(__pyx_k_tuple_99, 0, ((PyObject *)__pyx_kp_s_6));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
@@ -39919,7 +37954,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                     record = fields[0]
  */
   __pyx_k_tuple_101 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_101);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_101));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_100));
   PyTuple_SET_ITEM(__pyx_k_tuple_101, 0, ((PyObject *)__pyx_kp_s_100));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_100));
@@ -39933,7 +37968,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                     assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
  */
   __pyx_k_tuple_103 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_103);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_103));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
   PyTuple_SET_ITEM(__pyx_k_tuple_103, 0, ((PyObject *)__pyx_kp_s_5));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
@@ -39947,7 +37982,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                         # lowercase are permitted for user fields
  */
   __pyx_k_tuple_106 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_106);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_106));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_105));
   PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_kp_s_105));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_105));
@@ -39964,7 +37999,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_112 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_112);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_112));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_112, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -39978,7 +38013,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                 dest.target_len[x] = seqlen
  */
   __pyx_k_tuple_114 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_114);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_114));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_114, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -39992,7 +38027,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                 raise NotImplementedError( "can not iterate over samfile without header")
  */
   __pyx_k_tuple_115 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_115);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_115));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_115, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -40006,7 +38041,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_117);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_116));
   PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_116));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116));
@@ -40020,7 +38055,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         if not samfile._hasIndex():
  */
   __pyx_k_tuple_118 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_118);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_118));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -40034,7 +38069,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         # makes sure that samfile stays alive as long as the
  */
   __pyx_k_tuple_120 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_120);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_120));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_119));
   PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_kp_s_119));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119));
@@ -40048,7 +38083,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         if samfile.isbam: mode = b"rb"
  */
   __pyx_k_tuple_121 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_121);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_121));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_121, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -40062,7 +38097,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.tid = -1
  */
   __pyx_k_tuple_122 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_122);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_122));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
   PyTuple_SET_ITEM(__pyx_k_tuple_122, 0, ((PyObject *)__pyx_kp_s_60));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
@@ -40076,7 +38111,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         if not samfile._isOpen():
  */
   __pyx_k_tuple_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_123);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_123));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -40090,7 +38125,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         assert samfile.isbam, "can only use this iterator on bam files"
  */
   __pyx_k_tuple_124 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_124);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_124));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
   PyTuple_SET_ITEM(__pyx_k_tuple_124, 0, ((PyObject *)__pyx_kp_s_10));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
@@ -40104,7 +38139,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             if self.plp == NULL:
  */
   __pyx_k_tuple_130 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_130);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_130));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_129));
   PyTuple_SET_ITEM(__pyx_k_tuple_130, 0, ((PyObject *)__pyx_kp_s_129));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_129));
@@ -40118,7 +38153,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             # return result, if within same reference
  */
   __pyx_k_tuple_131 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_131);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_131));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_129));
   PyTuple_SET_ITEM(__pyx_k_tuple_131, 0, ((PyObject *)__pyx_kp_s_129));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_129));
@@ -40132,7 +38167,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         return "\t".join(map(str, (self.qname,
  */
   __pyx_k_tuple_133 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_133);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_133));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_133, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -40146,7 +38181,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                                    self.flag,
  */
   __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_134);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_134));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -40160,7 +38195,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_139 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_139);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_139));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_139, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -40174,7 +38209,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                                       len(value)] + list(value) )
  */
   __pyx_k_tuple_142 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_142);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_142));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_142, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -40188,7 +38223,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                         fmts.append( datafmt )
  */
   __pyx_k_tuple_143 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_143);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_143));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_143, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -40202,7 +38237,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                             fmt, pytype = "2scc", 'A'
  */
   __pyx_k_tuple_144 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_144);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_144));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_144, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -40216,7 +38251,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_146 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_146)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_146);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_146));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
   PyTuple_SET_ITEM(__pyx_k_tuple_146, 0, ((PyObject *)__pyx_n_s__ascii));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
@@ -40230,7 +38265,7 @@ static int __Pyx_InitCachedConstants(void) {
  *     def __str__(self):
  */
   __pyx_k_tuple_172 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_172)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_172);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_172));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_171));
   PyTuple_SET_ITEM(__pyx_k_tuple_172, 0, ((PyObject *)__pyx_kp_s_171));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_171));
@@ -40244,7 +38279,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             # warning: there could be problems if self.n and self.buf are
  */
   __pyx_k_tuple_174 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_174)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_174);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_174));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_173));
   PyTuple_SET_ITEM(__pyx_k_tuple_174, 0, ((PyObject *)__pyx_kp_s_173));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_173));
@@ -40258,7 +38293,7 @@ static int __Pyx_InitCachedConstants(void) {
  *     def __str__(self):
  */
   __pyx_k_tuple_175 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_175)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_175);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_175));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_171));
   PyTuple_SET_ITEM(__pyx_k_tuple_175, 0, ((PyObject *)__pyx_kp_s_171));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_171));
@@ -40272,7 +38307,7 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  */
   __pyx_k_tuple_180 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_180)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_180);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_180));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_179));
   PyTuple_SET_ITEM(__pyx_k_tuple_180, 0, ((PyObject *)__pyx_kp_s_179));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_179));
@@ -40286,7 +38321,7 @@ static int __Pyx_InitCachedConstants(void) {
  *         except UnicodeDecodeError:
  */
   __pyx_k_tuple_181 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_181);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_181));
   __Pyx_INCREF(Py_None);
   PyTuple_SET_ITEM(__pyx_k_tuple_181, 0, Py_None);
   __Pyx_GIVEREF(Py_None);
@@ -40306,7 +38341,7 @@ static int __Pyx_InitCachedConstants(void) {
  *                 out_stdout = inf.read()
  */
   __pyx_k_tuple_182 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_182)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_182);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_182));
   __Pyx_INCREF(Py_None);
   PyTuple_SET_ITEM(__pyx_k_tuple_182, 0, Py_None);
   __Pyx_GIVEREF(Py_None);
@@ -40326,7 +38361,7 @@ static int __Pyx_InitCachedConstants(void) {
  *     except UnicodeDecodeError:
  */
   __pyx_k_tuple_183 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_183)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_183);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_183));
   __Pyx_INCREF(Py_None);
   PyTuple_SET_ITEM(__pyx_k_tuple_183, 0, Py_None);
   __Pyx_GIVEREF(Py_None);
@@ -40346,7 +38381,7 @@ static int __Pyx_InitCachedConstants(void) {
  *             out_stderr = inf.read()
  */
   __pyx_k_tuple_184 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_184)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_184);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_184));
   __Pyx_INCREF(Py_None);
   PyTuple_SET_ITEM(__pyx_k_tuple_184, 0, Py_None);
   __Pyx_GIVEREF(Py_None);
@@ -40366,132 +38401,12 @@ static int __Pyx_InitCachedConstants(void) {
  * #####################################################################
  */
   __pyx_k_tuple_252 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_252)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_252);
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_252));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_251));
   PyTuple_SET_ITEM(__pyx_k_tuple_252, 0, ((PyObject *)__pyx_kp_s_251));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_251));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_252));
 
-  /* "csamtools.pyx":260
- *         list of reads (:class:`pysam.PileupRead`) aligned to this column
- *     '''
- *     def __str__(self):             # <<<<<<<<<<<<<<
- *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
- *             "\n" + "\n".join( map(str, self.pileups) )
- */
-  __pyx_k_tuple_254 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_254)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_254);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_254, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_254));
-  __pyx_k_codeobj_255 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_254, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____str__, 260, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":308
- *     stderr is captured.
- *     '''
- *     def __init__(self):             # <<<<<<<<<<<<<<
- *         return
- *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
- */
-  __pyx_k_tuple_258 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_258)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_258);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_258, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_258));
-  __pyx_k_codeobj_259 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_258, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 308, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_259)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":314
- *         self.stderr_save.setfd( self.stderr_h )
- * 
- *     def readAndRelease( self ):             # <<<<<<<<<<<<<<
- *         return []
- *         self.stderr_save.restore()
- */
-  __pyx_k_tuple_260 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_260)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_260);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_260, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_260));
-  __pyx_k_codeobj_261 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_260, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__readAndRelease, 314, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_261)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":323
- *         return lines
- * 
- *     def release(self):             # <<<<<<<<<<<<<<
- *         return
- *         self.stderr_save.restore()
- */
-  __pyx_k_tuple_262 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_262)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_262);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_262, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_262));
-  __pyx_k_codeobj_263 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_262, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__release, 323, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_263)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":329
- *             os.remove( self.stderr_f )
- * 
- *     def __del__(self):             # <<<<<<<<<<<<<<
- *         self.release()
- * 
- */
-  __pyx_k_tuple_264 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_264)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_264);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_264, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_264));
-  __pyx_k_codeobj_265 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_264, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____del__, 329, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_265)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":334
- * class StderrStoreWindows():
- *     '''does nothing. stderr can't be redirected on windows'''
- *     def __init__(self): pass             # <<<<<<<<<<<<<<
- *     def readAndRelease(self): return []
- *     def release(self): pass
- */
-  __pyx_k_tuple_267 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_267)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_267);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_267, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_267));
-  __pyx_k_codeobj_268 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_267, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 334, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_268)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":335
- *     '''does nothing. stderr can't be redirected on windows'''
- *     def __init__(self): pass
- *     def readAndRelease(self): return []             # <<<<<<<<<<<<<<
- *     def release(self): pass
- * 
- */
-  __pyx_k_tuple_269 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_269)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_269);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_269, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_269));
-  __pyx_k_codeobj_270 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_269, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__readAndRelease, 335, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_270)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":336
- *     def __init__(self): pass
- *     def readAndRelease(self): return []
- *     def release(self): pass             # <<<<<<<<<<<<<<
- * 
- * if platform.system()=='Windows':
- */
-  __pyx_k_tuple_271 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_271)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_271);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_271, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_271));
-  __pyx_k_codeobj_272 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_271, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__release, 336, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_272)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
   /* "csamtools.pyx":354
  * 
  * # order of records within sam headers
@@ -40499,302 +38414,146 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * # type conversions within sam header records
  */
-  __pyx_k_tuple_274 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_274)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_274);
+  __pyx_k_tuple_257 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_257)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_257));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__HD));
-  PyTuple_SET_ITEM(__pyx_k_tuple_274, 0, ((PyObject *)__pyx_n_s__HD));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 0, ((PyObject *)__pyx_n_s__HD));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HD));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__SQ));
-  PyTuple_SET_ITEM(__pyx_k_tuple_274, 1, ((PyObject *)__pyx_n_s__SQ));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 1, ((PyObject *)__pyx_n_s__SQ));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SQ));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__RG));
-  PyTuple_SET_ITEM(__pyx_k_tuple_274, 2, ((PyObject *)__pyx_n_s__RG));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 2, ((PyObject *)__pyx_n_s__RG));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RG));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__PG));
-  PyTuple_SET_ITEM(__pyx_k_tuple_274, 3, ((PyObject *)__pyx_n_s__PG));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 3, ((PyObject *)__pyx_n_s__PG));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PG));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__CO));
-  PyTuple_SET_ITEM(__pyx_k_tuple_274, 4, ((PyObject *)__pyx_n_s__CO));
+  PyTuple_SET_ITEM(__pyx_k_tuple_257, 4, ((PyObject *)__pyx_n_s__CO));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CO));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_274));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_257));
 
   /* "csamtools.pyx":364
  * 
  * # output order of fields within records
  * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),             # <<<<<<<<<<<<<<
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
  */
-  __pyx_k_tuple_275 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_275)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_275);
+  __pyx_k_tuple_258 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_258)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_258));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
-  PyTuple_SET_ITEM(__pyx_k_tuple_275, 0, ((PyObject *)__pyx_n_s__VN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_258, 0, ((PyObject *)__pyx_n_s__VN));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__SO));
-  PyTuple_SET_ITEM(__pyx_k_tuple_275, 1, ((PyObject *)__pyx_n_s__SO));
+  PyTuple_SET_ITEM(__pyx_k_tuple_258, 1, ((PyObject *)__pyx_n_s__SO));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SO));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__GO));
-  PyTuple_SET_ITEM(__pyx_k_tuple_275, 2, ((PyObject *)__pyx_n_s__GO));
+  PyTuple_SET_ITEM(__pyx_k_tuple_258, 2, ((PyObject *)__pyx_n_s__GO));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GO));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_275));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_258));
 
   /* "csamtools.pyx":365
  * # output order of fields within records
  * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),             # <<<<<<<<<<<<<<
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
+ *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
  */
-  __pyx_k_tuple_276 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_276)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_276);
+  __pyx_k_tuple_259 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_259)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_259));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__SN));
-  PyTuple_SET_ITEM(__pyx_k_tuple_276, 0, ((PyObject *)__pyx_n_s__SN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_259, 0, ((PyObject *)__pyx_n_s__SN));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SN));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__LN));
-  PyTuple_SET_ITEM(__pyx_k_tuple_276, 1, ((PyObject *)__pyx_n_s__LN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_259, 1, ((PyObject *)__pyx_n_s__LN));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LN));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__AS));
-  PyTuple_SET_ITEM(__pyx_k_tuple_276, 2, ((PyObject *)__pyx_n_s__AS));
+  PyTuple_SET_ITEM(__pyx_k_tuple_259, 2, ((PyObject *)__pyx_n_s__AS));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AS));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__M5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_276, 3, ((PyObject *)__pyx_n_s__M5));
+  PyTuple_SET_ITEM(__pyx_k_tuple_259, 3, ((PyObject *)__pyx_n_s__M5));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M5));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__UR));
-  PyTuple_SET_ITEM(__pyx_k_tuple_276, 4, ((PyObject *)__pyx_n_s__UR));
+  PyTuple_SET_ITEM(__pyx_k_tuple_259, 4, ((PyObject *)__pyx_n_s__UR));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UR));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__SP));
-  PyTuple_SET_ITEM(__pyx_k_tuple_276, 5, ((PyObject *)__pyx_n_s__SP));
+  PyTuple_SET_ITEM(__pyx_k_tuple_259, 5, ((PyObject *)__pyx_n_s__SP));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SP));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_276));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_259));
 
   /* "csamtools.pyx":366
  * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),             # <<<<<<<<<<<<<<
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),             # <<<<<<<<<<<<<<
+ *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
  * 
  */
-  __pyx_k_tuple_277 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_277)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_277);
+  __pyx_k_tuple_260 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_260)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_260));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 0, ((PyObject *)__pyx_n_s__ID));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 0, ((PyObject *)__pyx_n_s__ID));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__SM));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 1, ((PyObject *)__pyx_n_s__SM));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 1, ((PyObject *)__pyx_n_s__SM));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SM));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__LB));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 2, ((PyObject *)__pyx_n_s__LB));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 2, ((PyObject *)__pyx_n_s__LB));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LB));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__DS));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 3, ((PyObject *)__pyx_n_s__DS));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 3, ((PyObject *)__pyx_n_s__DS));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DS));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__PU));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 4, ((PyObject *)__pyx_n_s__PU));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 4, ((PyObject *)__pyx_n_s__PU));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PU));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__PI));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 5, ((PyObject *)__pyx_n_s__PI));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 5, ((PyObject *)__pyx_n_s__PI));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PI));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__CN));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 6, ((PyObject *)__pyx_n_s__CN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 6, ((PyObject *)__pyx_n_s__CN));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CN));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__DT));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 7, ((PyObject *)__pyx_n_s__DT));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 7, ((PyObject *)__pyx_n_s__DT));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DT));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__PL));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 8, ((PyObject *)__pyx_n_s__PL));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 8, ((PyObject *)__pyx_n_s__PL));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PL));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__FO));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 9, ((PyObject *)__pyx_n_s__FO));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 9, ((PyObject *)__pyx_n_s__FO));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FO));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__KS));
-  PyTuple_SET_ITEM(__pyx_k_tuple_277, 10, ((PyObject *)__pyx_n_s__KS));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 10, ((PyObject *)__pyx_n_s__KS));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__KS));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_277));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PG));
+  PyTuple_SET_ITEM(__pyx_k_tuple_260, 11, ((PyObject *)__pyx_n_s__PG));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PG));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_260));
 
   /* "csamtools.pyx":367
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }             # <<<<<<<<<<<<<<
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
+ *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  __pyx_k_tuple_278 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_278)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_278);
+  __pyx_k_tuple_261 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_261)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_261));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__PN));
-  PyTuple_SET_ITEM(__pyx_k_tuple_278, 0, ((PyObject *)__pyx_n_s__PN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_261, 0, ((PyObject *)__pyx_n_s__PN));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PN));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
-  PyTuple_SET_ITEM(__pyx_k_tuple_278, 1, ((PyObject *)__pyx_n_s__ID));
+  PyTuple_SET_ITEM(__pyx_k_tuple_261, 1, ((PyObject *)__pyx_n_s__ID));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
-  PyTuple_SET_ITEM(__pyx_k_tuple_278, 2, ((PyObject *)__pyx_n_s__VN));
+  PyTuple_SET_ITEM(__pyx_k_tuple_261, 2, ((PyObject *)__pyx_n_s__VN));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__CL));
-  PyTuple_SET_ITEM(__pyx_k_tuple_278, 3, ((PyObject *)__pyx_n_s__CL));
+  PyTuple_SET_ITEM(__pyx_k_tuple_261, 3, ((PyObject *)__pyx_n_s__CL));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CL));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_278));
-
-  /* "csamtools.pyx":3092
- * class Outs:
- *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
- *     def __init__(self, id = 1):             # <<<<<<<<<<<<<<
- *         self.streams = []
- *         self.id = id
- */
-  __pyx_k_tuple_279 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_279)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_279);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_279, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__id));
-  PyTuple_SET_ITEM(__pyx_k_tuple_279, 1, ((PyObject *)__pyx_n_s__id));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_279));
-  __pyx_k_codeobj_280 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_279, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 3092, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_280)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_k_tuple_281 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_281)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_281);
-  __Pyx_INCREF(((PyObject *)__pyx_int_1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_281, 0, ((PyObject *)__pyx_int_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_int_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_281));
-
-  /* "csamtools.pyx":3096
- *         self.id = id
- * 
- *     def setdevice(self, filename):             # <<<<<<<<<<<<<<
- *         '''open an existing file, like "/dev/null"'''
- *         fd = os.open(filename, os.O_WRONLY)
- */
-  __pyx_k_tuple_282 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_282)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_282);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_282, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__filename));
-  PyTuple_SET_ITEM(__pyx_k_tuple_282, 1, ((PyObject *)__pyx_n_s__filename));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fd));
-  PyTuple_SET_ITEM(__pyx_k_tuple_282, 2, ((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_282));
-  __pyx_k_codeobj_283 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setdevice, 3096, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_283)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":3101
- *         self.setfd(fd)
- * 
- *     def setfile(self, filename):             # <<<<<<<<<<<<<<
- *         '''open a new file.'''
- *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
- */
-  __pyx_k_tuple_284 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_284)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_284);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_284, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__filename));
-  PyTuple_SET_ITEM(__pyx_k_tuple_284, 1, ((PyObject *)__pyx_n_s__filename));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fd));
-  PyTuple_SET_ITEM(__pyx_k_tuple_284, 2, ((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_284));
-  __pyx_k_codeobj_285 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_284, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setfile, 3101, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_285)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":3106
- *         self.setfd(fd)
- * 
- *     def setfd(self, fd):             # <<<<<<<<<<<<<<
- *         ofd = os.dup(self.id)      #  Save old stream on new unit.
- *         self.streams.append(ofd)
- */
-  __pyx_k_tuple_286 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_286)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_286);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_286, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fd));
-  PyTuple_SET_ITEM(__pyx_k_tuple_286, 1, ((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ofd));
-  PyTuple_SET_ITEM(__pyx_k_tuple_286, 2, ((PyObject *)__pyx_n_s__ofd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ofd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_286));
-  __pyx_k_codeobj_287 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setfd, 3106, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_287)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":3114
- *         os.close(fd)                #  Close other unit (look out, caller.)
- * 
- *     def restore(self):             # <<<<<<<<<<<<<<
- *         '''restore previous output stream'''
- *         if self.streams:
- */
-  __pyx_k_tuple_288 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_288)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_288);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_288, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_288));
-  __pyx_k_codeobj_289 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__restore, 3114, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_289)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "csamtools.pyx":3125
- *             del self.streams[-1]
- * 
- * def _samtools_dispatch( method,             # <<<<<<<<<<<<<<
- *                         args = (),
- *                         catch_stdout = True ):
- */
-  __pyx_k_tuple_291 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_291)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_291);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__method));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 0, ((PyObject *)__pyx_n_s__method));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__method));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__args));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 1, ((PyObject *)__pyx_n_s__args));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__args));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__catch_stdout));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 2, ((PyObject *)__pyx_n_s__catch_stdout));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__catch_stdout));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__stderr_h));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 3, ((PyObject *)__pyx_n_s__stderr_h));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stderr_h));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__stderr_f));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 4, ((PyObject *)__pyx_n_s__stderr_f));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stderr_f));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__stdout_h));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 5, ((PyObject *)__pyx_n_s__stdout_h));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stdout_h));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__stdout_f));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 6, ((PyObject *)__pyx_n_s__stdout_f));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stdout_f));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__stdout_save));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 7, ((PyObject *)__pyx_n_s__stdout_save));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stdout_save));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cargs));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 8, ((PyObject *)__pyx_n_s__cargs));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cargs));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 9, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 10, ((PyObject *)__pyx_n_s__n));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__retval));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 11, ((PyObject *)__pyx_n_s__retval));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__retval));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__inf));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 12, ((PyObject *)__pyx_n_s__inf));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inf));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out_stdout));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 13, ((PyObject *)__pyx_n_s__out_stdout));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out_stdout));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out_stderr));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 14, ((PyObject *)__pyx_n_s__out_stderr));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out_stderr));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
-  PyTuple_SET_ITEM(__pyx_k_tuple_291, 15, ((PyObject *)__pyx_n_s__a));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_291));
-  __pyx_k_codeobj_292 = (PyObject*)__Pyx_PyCode_New(3, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s___samtools_dispatch, 3125, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_292)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__PP));
+  PyTuple_SET_ITEM(__pyx_k_tuple_261, 4, ((PyObject *)__pyx_n_s__PP));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PP));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_261));
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -40853,18 +38612,12 @@ PyMODINIT_FUNC PyInit_csamtools(void)
           Py_FatalError("failed to import 'refnanny' module");
   }
   #endif
-  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_csamtools(void)", 0);
+  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_csamtools(void)");
   if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #ifdef __Pyx_CyFunction_USED
-  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #endif
-  #ifdef __Pyx_FusedFunction_USED
-  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #endif
-  #ifdef __Pyx_Generator_USED
-  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifdef __pyx_binding_PyCFunctionType_USED
+  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
   /*--- Library function declarations ---*/
   /*--- Threads initialization code ---*/
@@ -40910,9 +38663,9 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_AlignedRead, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_11AlignedRead_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_11AlignedRead_4__str__.doc = __pyx_doc_9csamtools_11AlignedRead_4__str__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_11AlignedRead_4__str__;
+      __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__.doc = __pyx_doc_9csamtools_11AlignedRead_2__str__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_11AlignedRead_2__str__;
     }
   }
   if (__Pyx_SetAttrString(__pyx_m, "AlignedRead", (PyObject *)&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -40927,9 +38680,9 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_Samfile, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_7Samfile_42__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_7Samfile_42__next__.doc = __pyx_doc_9csamtools_7Samfile_42__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_7Samfile_42__next__;
+      __pyx_wrapperbase_9csamtools_7Samfile_21__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_7Samfile_21__next__.doc = __pyx_doc_9csamtools_7Samfile_21__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_7Samfile_21__next__;
     }
   }
   if (__Pyx_SetVtable(__pyx_type_9csamtools_Samfile.tp_dict, __pyx_vtabptr_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -40952,9 +38705,9 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_17IteratorRowRegion_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_17IteratorRowRegion_4__next__.doc = __pyx_doc_9csamtools_17IteratorRowRegion_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_17IteratorRowRegion_4__next__;
+      __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__.doc = __pyx_doc_9csamtools_17IteratorRowRegion_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__;
     }
   }
   if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -40968,9 +38721,9 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAll, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_14IteratorRowAll_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_14IteratorRowAll_4__next__.doc = __pyx_doc_9csamtools_14IteratorRowAll_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_14IteratorRowAll_4__next__;
+      __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__.doc = __pyx_doc_9csamtools_14IteratorRowAll_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__;
     }
   }
   if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowAll.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -40981,9 +38734,9 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_6__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_6__next__.doc = __pyx_doc_9csamtools_18IteratorRowAllRefs_6__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_6__next__;
+      __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__.doc = __pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__;
     }
   }
   if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -40996,9 +38749,9 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowSelection, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_20IteratorRowSelection_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_20IteratorRowSelection_4__next__.doc = __pyx_doc_9csamtools_20IteratorRowSelection_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorRowSelection_4__next__;
+      __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__.doc = __pyx_doc_9csamtools_20IteratorRowSelection_2__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__;
     }
   }
   if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowSelection.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -41021,9 +38774,9 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_2__next__.doc = __pyx_doc_9csamtools_20IteratorColumnRegion_2__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorColumnRegion_2__next__;
+      __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__.doc = __pyx_doc_9csamtools_20IteratorColumnRegion_1__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__;
     }
   }
   if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -41036,9 +38789,9 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
-      __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_2__next__.doc = __pyx_doc_9csamtools_21IteratorColumnAllRefs_2__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_2__next__;
+      __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+      __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__.doc = __pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__;
+      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__;
     }
   }
   if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnAllRefs.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -41050,8 +38803,12 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyType_Ready(&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetAttrString(__pyx_m, "SNPCall", (PyObject *)&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_9csamtools_SNPCall = &__pyx_type_9csamtools_SNPCall;
+  if (PyType_Ready(&__pyx_Generator_type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools___pyx_Generator = &__pyx_Generator_type;
+  __pyx_type_9csamtools___pyx_scope_struct__genexpr.tp_base = __pyx_ptype_9csamtools___pyx_Generator;
   if (PyType_Ready(&__pyx_type_9csamtools___pyx_scope_struct__genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_9csamtools___pyx_scope_struct__genexpr = &__pyx_type_9csamtools___pyx_scope_struct__genexpr;
+  __pyx_type_9csamtools___pyx_scope_struct_1_genexpr.tp_base = __pyx_ptype_9csamtools___pyx_Generator;
   if (PyType_Ready(&__pyx_type_9csamtools___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_9csamtools___pyx_scope_struct_1_genexpr = &__pyx_type_9csamtools___pyx_scope_struct_1_genexpr;
   /*--- Type import code ---*/
@@ -41317,10 +39074,10 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  * else:
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
  */
-    __pyx_t_1 = __pyx_pf_9csamtools_2genexpr(NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __pyx_pf_9csamtools_1genexpr(NULL, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_1 = 0;
@@ -41340,10 +39097,10 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )
  * 
  */
-    __pyx_t_1 = __pyx_pf_9csamtools_5genexpr(NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __pyx_pf_9csamtools_3genexpr(NULL, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_1 = 0;
@@ -41417,7 +39174,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" + "\n".join( map(str, self.pileups) )
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_12PileupColumn_1__str__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_255)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_12PileupColumn___str__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____str__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -41430,11 +39187,11 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *     all the reads that map to a certain target base.
  */
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_builtin_object);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
   __Pyx_GIVEREF(__pyx_builtin_object);
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_257)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_254)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__PileupColumn, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
@@ -41459,7 +39216,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         return
  *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_11StderrStore_1__init__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_259)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41471,7 +39228,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         return []
  *         self.stderr_save.restore()
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_11StderrStore_3readAndRelease, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_261)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_1readAndRelease, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41483,7 +39240,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         return
  *         self.stderr_save.restore()
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_11StderrStore_5release, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_263)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_2release, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41495,7 +39252,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         self.release()
  * 
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_11StderrStore_7__del__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_265)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_3__del__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____del__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41507,7 +39264,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *     '''
  *     stderr is captured.
  */
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_266)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_255)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStore, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -41531,7 +39288,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *     def readAndRelease(self): return []
  *     def release(self): pass
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_1__init__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_268)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41543,7 +39300,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *     def release(self): pass
  * 
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_3readAndRelease, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_270)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_1readAndRelease, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41555,7 +39312,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  * 
  * if platform.system()=='Windows':
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_5release, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_272)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_2release, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41567,7 +39324,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *     '''does nothing. stderr can't be redirected on windows'''
  *     def __init__(self): pass
  */
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_273)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_256)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStoreWindows, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStoreWindows, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -41673,7 +39430,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  * 
  * # type conversions within sam header records
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, ((PyObject *)__pyx_k_tuple_274)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, ((PyObject *)__pyx_k_tuple_257)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":357
  * 
@@ -41697,7 +39454,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
  *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },             # <<<<<<<<<<<<<<
  *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str,
- *                                  "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str },
+ *                                  "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str, "PG" : str,},
  */
   __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -41714,8 +39471,8 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
  *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
  *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str,             # <<<<<<<<<<<<<<
- *                                  "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str },
- *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
+ *                                  "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str, "PG" : str,},
+ *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str }, }
  */
   __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -41729,8 +39486,8 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   /* "csamtools.pyx":360
  *                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
  *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str,
- *                                  "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str },             # <<<<<<<<<<<<<<
- *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
+ *                                  "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str, "PG" : str,},             # <<<<<<<<<<<<<<
+ *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str }, }
  * 
  */
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__CN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -41738,13 +39495,14 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__FO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__KS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
 
   /* "csamtools.pyx":361
  *                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str,
- *                                  "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str },
- *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }             # <<<<<<<<<<<<<<
+ *                                  "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str, "PG" : str,},
+ *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str }, }             # <<<<<<<<<<<<<<
  * 
  * # output order of fields within records
  */
@@ -41754,6 +39512,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__CL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -41764,38 +39523,38 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  * # output order of fields within records
  * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),             # <<<<<<<<<<<<<<
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_k_tuple_275)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_k_tuple_258)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":365
  * # output order of fields within records
  * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),             # <<<<<<<<<<<<<<
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
+ *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
  */
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_k_tuple_276)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_k_tuple_259)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":366
  * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),             # <<<<<<<<<<<<<<
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),             # <<<<<<<<<<<<<<
+ *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
  * 
  */
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_k_tuple_277)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_k_tuple_260)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "csamtools.pyx":367
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
- *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
- *                        "PG" : ( "PN", "ID", "VN", "CL" ), }             # <<<<<<<<<<<<<<
+ *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
+ *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_k_tuple_278)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_k_tuple_261)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
@@ -41890,9 +39649,8 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         self.streams = []
  *         self.id = id
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_1__init__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_280)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, ((PyObject *)__pyx_k_tuple_281));
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
@@ -41903,7 +39661,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         '''open an existing file, like "/dev/null"'''
  *         fd = os.open(filename, os.O_WRONLY)
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_3setdevice, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_283)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_1setdevice, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__setdevice, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41915,7 +39673,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         '''open a new file.'''
  *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_5setfile, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_285)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_2setfile, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__setfile, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41927,7 +39685,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         ofd = os.dup(self.id)      #  Save old stream on new unit.
  *         self.streams.append(ofd)
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_7setfd, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_287)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_3setfd, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__setfd, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41939,7 +39697,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *         '''restore previous output stream'''
  *         if self.streams:
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_9restore, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_289)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_4restore, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__restore, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -41951,7 +39709,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
  *     def __init__(self, id = 1):
  */
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_290)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_262)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__Outs, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Outs, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -41978,7 +39736,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *                         args = (),
  *                         catch_stdout = True ):
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9csamtools_1_samtools_dispatch, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9csamtools__samtools_dispatch, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s___samtools_dispatch, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -41991,7 +39749,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  *            "IteratorRow",
  */
   __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Samfile));
   PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Samfile));
@@ -42052,6 +39810,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
 }
 
 /* Runtime support code */
+
 #if CYTHON_REFNANNY
 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
     PyObject *m = NULL, *p = NULL;
@@ -42083,7 +39842,9 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     return result;
 }
 
+
 #if CYTHON_PROFILE
+
 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
                                    PyFrameObject** frame,
                                    const char *funcname,
@@ -42107,10 +39868,12 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
     }
     return PyThreadState_GET()->c_profilefunc(PyThreadState_GET()->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
 }
+
 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
     PyObject *py_srcfile = 0;
     PyObject *py_funcname = 0;
     PyCodeObject *py_code = 0;
+
     #if PY_MAJOR_VERSION < 3
     py_funcname = PyString_FromString(funcname);
     py_srcfile = PyString_FromString(srcfile);
@@ -42119,6 +39882,7 @@ static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const cha
     py_srcfile = PyUnicode_FromString(srcfile);
     #endif
     if (!py_funcname | !py_srcfile) goto bad;
+
     py_code = PyCode_New(
         0,                /*int argcount,*/
         #if PY_MAJOR_VERSION >= 3
@@ -42138,17 +39902,20 @@ static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const cha
         firstlineno,      /*int firstlineno,*/
         __pyx_empty_bytes   /*PyObject *lnotab*/
     );
+
 bad:
     Py_XDECREF(py_srcfile);
     Py_XDECREF(py_funcname);
+
     return py_code;
 }
+
 #endif /* CYTHON_PROFILE */
 
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
+
     tmp_type = tstate->curexc_type;
     tmp_value = tstate->curexc_value;
     tmp_tb = tstate->curexc_traceback;
@@ -42158,30 +39925,27 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
-#else
-    PyErr_Restore(type, value, tb);
-#endif
 }
+
 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
     *type = tstate->curexc_type;
     *value = tstate->curexc_value;
     *tb = tstate->curexc_traceback;
+
     tstate->curexc_type = 0;
     tstate->curexc_value = 0;
     tstate->curexc_traceback = 0;
-#else
-    PyErr_Fetch(type, value, tb);
-#endif
 }
 
+
 #if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
-                        CYTHON_UNUSED PyObject *cause) {
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+    /* cause is unused */
     Py_XINCREF(type);
     Py_XINCREF(value);
     Py_XINCREF(tb);
+    /* First, check the traceback argument, replacing None with NULL. */
     if (tb == Py_None) {
         Py_DECREF(tb);
         tb = 0;
@@ -42191,6 +39955,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
             "raise: arg 3 must be a traceback or None");
         goto raise_error;
     }
+    /* Next, replace a missing value with None */
     if (value == NULL) {
         value = Py_None;
         Py_INCREF(value);
@@ -42201,11 +39966,13 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
     if (!PyType_Check(type))
     #endif
     {
+        /* Raising an instance.  The value should be a dummy. */
         if (value != Py_None) {
             PyErr_SetString(PyExc_TypeError,
                 "instance exception may not have a separate value");
             goto raise_error;
         }
+        /* Normalize to raise <class>, <instance> */
         Py_DECREF(value);
         value = type;
         #if PY_VERSION_HEX < 0x02050000
@@ -42229,6 +39996,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
             }
         #endif
     }
+
     __Pyx_ErrRestore(type, value, tb);
     return;
 raise_error:
@@ -42237,7 +40005,9 @@ raise_error:
     Py_XDECREF(tb);
     return;
 }
+
 #else /* Python 3+ */
+
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
     if (tb == Py_None) {
         tb = 0;
@@ -42248,6 +40018,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
     }
     if (value == Py_None)
         value = 0;
+
     if (PyExceptionInstance_Check(type)) {
         if (value) {
             PyErr_SetString(PyExc_TypeError,
@@ -42261,6 +40032,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+
     if (cause) {
         PyObject *fixed_cause;
         if (PyExceptionClass_Check(cause)) {
@@ -42283,7 +40055,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
         PyException_SetCause(value, fixed_cause);
     }
+
     PyErr_SetObject(type, value);
+
     if (tb) {
         PyThreadState *tstate = PyThreadState_GET();
         PyObject* tmp_tb = tstate->curexc_traceback;
@@ -42293,6 +40067,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
             Py_XDECREF(tmp_tb);
         }
     }
+
 bad:
     return;
 }
@@ -42321,7 +40096,7 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
         #if PY_MAJOR_VERSION < 3
         if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
         #else
-        if (unlikely(!PyUnicode_Check(key)))
+        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
         #endif
             goto invalid_keyword_type;
     }
@@ -42369,6 +40144,7 @@ static int __Pyx_ParseOptionalKeywords(
     Py_ssize_t pos = 0;
     PyObject*** name;
     PyObject*** first_kw_arg = argnames + num_pos_args;
+
     while (PyDict_Next(kwds, &pos, &key, &value)) {
         name = first_kw_arg;
         while (*name && (**name != key)) name++;
@@ -42378,7 +40154,7 @@ static int __Pyx_ParseOptionalKeywords(
             #if PY_MAJOR_VERSION < 3
             if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
             #else
-            if (unlikely(!PyUnicode_Check(key))) {
+            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
             #endif
                 goto invalid_keyword_type;
             } else {
@@ -42394,6 +40170,7 @@ static int __Pyx_ParseOptionalKeywords(
                 if (*name) {
                     values[name-argnames] = value;
                 } else {
+                    /* unexpected keyword found */
                     for (name=argnames; name != first_kw_arg; name++) {
                         if (**name == key) goto arg_passed_twice;
                         #if PY_MAJOR_VERSION >= 3
@@ -42443,6 +40220,7 @@ static void __Pyx_RaiseArgtupleInvalid(
 {
     Py_ssize_t num_expected;
     const char *more_or_less;
+
     if (num_found < num_min) {
         num_expected = num_min;
         more_or_less = "at least";
@@ -42575,7 +40353,6 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
 }
 
 
-
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
     PyThreadState *tstate = PyThreadState_GET();
     *type = tstate->exc_type;
@@ -42585,6 +40362,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value,
     Py_XINCREF(*value);
     Py_XINCREF(*tb);
 }
+
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
@@ -42625,33 +40403,12 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
         goto bad;
     #if PY_VERSION_HEX >= 0x02050000
     {
-        #if PY_MAJOR_VERSION >= 3
-        if (level == -1) {
-            if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
-                PyObject *py_level = PyInt_FromLong(1);
-                if (!py_level)
-                    goto bad;
-                module = PyObject_CallFunctionObjArgs(py_import,
-                    name, global_dict, empty_dict, list, py_level, NULL);
-                Py_DECREF(py_level);
-                if (!module) {
-                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
-                        goto bad;
-                    PyErr_Clear();
-                }
-            }
-            level = 0; /* try absolute import on failure */
-        }
-        #endif
-        if (!module) {
-            PyObject *py_level = PyInt_FromLong(level);
-            if (!py_level)
-                goto bad;
-            module = PyObject_CallFunctionObjArgs(py_import,
-                name, global_dict, empty_dict, list, py_level, NULL);
-            Py_DECREF(py_level);
-        }
+        PyObject *py_level = PyInt_FromLong(level);
+        if (!py_level)
+            goto bad;
+        module = PyObject_CallFunctionObjArgs(py_import,
+            name, global_dict, empty_dict, list, py_level, NULL);
+        Py_DECREF(py_level);
     }
     #else
     if (level>0) {
@@ -42698,8 +40455,10 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na
                                    PyObject *modname) {
     PyObject *result;
     PyObject *metaclass;
+
     if (PyDict_SetItemString(dict, "__module__", modname) < 0)
         return NULL;
+
     /* Python2 __metaclass__ */
     metaclass = PyDict_GetItemString(dict, "__metaclass__");
     if (metaclass) {
@@ -42712,367 +40471,48 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na
     return result;
 }
 
-static PyObject *
-__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
-{
-    if (op->func_doc == NULL && op->func.m_ml->ml_doc) {
-#if PY_MAJOR_VERSION >= 3
-        op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
-#else
-        op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
-#endif
-    }
-    if (op->func_doc == 0) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
-    Py_INCREF(op->func_doc);
-    return op->func_doc;
-}
-static int
-__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
-{
-    PyObject *tmp = op->func_doc;
-    if (value == NULL)
-        op->func_doc = Py_None; /* Mark as deleted */
-    else
-        op->func_doc = value;
-    Py_INCREF(op->func_doc);
-    Py_XDECREF(tmp);
-    return 0;
-}
-static PyObject *
-__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
-{
-    if (op->func_name == NULL) {
-#if PY_MAJOR_VERSION >= 3
-        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
-#else
-        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
-#endif
-    }
-    Py_INCREF(op->func_name);
-    return op->func_name;
-}
-static int
-__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
-{
-    PyObject *tmp;
-#if PY_MAJOR_VERSION >= 3
-    if (value == NULL || !PyUnicode_Check(value)) {
-#else
-    if (value == NULL || !PyString_Check(value)) {
-#endif
-        PyErr_SetString(PyExc_TypeError,
-                        "__name__ must be set to a string object");
-        return -1;
-    }
-    tmp = op->func_name;
-    Py_INCREF(value);
-    op->func_name = value;
-    Py_XDECREF(tmp);
-    return 0;
-}
-static PyObject *
-__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
-{
-    PyObject *self;
-    self = m->func_closure;
-    if (self == NULL)
-        self = Py_None;
-    Py_INCREF(self);
-    return self;
-}
-static PyObject *
-__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
-{
-    if (op->func_dict == NULL) {
-        op->func_dict = PyDict_New();
-        if (op->func_dict == NULL)
-            return NULL;
-    }
-    Py_INCREF(op->func_dict);
-    return op->func_dict;
-}
-static int
-__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
-{
-    PyObject *tmp;
-    if (value == NULL) {
-        PyErr_SetString(PyExc_TypeError,
-               "function's dictionary may not be deleted");
-        return -1;
-    }
-    if (!PyDict_Check(value)) {
-        PyErr_SetString(PyExc_TypeError,
-               "setting function's dictionary to a non-dict");
-        return -1;
-    }
-    tmp = op->func_dict;
-    Py_INCREF(value);
-    op->func_dict = value;
-    Py_XDECREF(tmp);
-    return 0;
-}
-static PyObject *
-__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
-{
-    PyObject* dict = PyModule_GetDict(__pyx_m);
-    Py_XINCREF(dict);
-    return dict;
-}
-static PyObject *
-__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
-{
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-static PyObject *
-__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
-{
-    PyObject* result = (op->func_code) ? op->func_code : Py_None;
-    Py_INCREF(result);
-    return result;
-}
-static PyObject *
-__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
-{
-    if (op->defaults_tuple) {
-        Py_INCREF(op->defaults_tuple);
-        return op->defaults_tuple;
-    }
-    if (op->defaults_getter) {
-        PyObject *res = op->defaults_getter((PyObject *) op);
-        if (res) {
-            Py_INCREF(res);
-            op->defaults_tuple = res;
-        }
-        return res;
-    }
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-static PyGetSetDef __pyx_CyFunction_getsets[] = {
-    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
-    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
-    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
-    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
-    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
-    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
-    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
-    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
-    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
-    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
-    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
-    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
-    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
-    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
-    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
-    {0, 0, 0, 0, 0}
-};
-#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
-#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
-#endif
-static PyMemberDef __pyx_CyFunction_members[] = {
-    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
-    {0, 0, 0,  0, 0}
-};
-static PyObject *
-__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
-{
-#if PY_MAJOR_VERSION >= 3
-    return PyUnicode_FromString(m->func.m_ml->ml_name);
-#else
-    return PyString_FromString(m->func.m_ml->ml_name);
-#endif
-}
-static PyMethodDef __pyx_CyFunction_methods[] = {
-    {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
-    {0, 0, 0, 0}
-};
-static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
-                                      PyObject *closure, PyObject *module, PyObject* code) {
-    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
+
+static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
+    __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
     if (op == NULL)
         return NULL;
-    op->flags = flags;
-    op->func_weakreflist = NULL;
     op->func.m_ml = ml;
-    op->func.m_self = (PyObject *) op;
-    Py_XINCREF(closure);
-    op->func_closure = closure;
+    Py_XINCREF(self);
+    op->func.m_self = self;
     Py_XINCREF(module);
     op->func.m_module = module;
-    op->func_dict = NULL;
-    op->func_name = NULL;
-    op->func_doc = NULL;
-    op->func_classobj = NULL;
-    Py_XINCREF(code);
-    op->func_code = code;
-    op->defaults_pyobjects = 0;
-    op->defaults = NULL;
-    op->defaults_tuple = NULL;
-    op->defaults_getter = NULL;
     PyObject_GC_Track(op);
-    return (PyObject *) op;
-}
-static int
-__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
-{
-    Py_CLEAR(m->func_closure);
-    Py_CLEAR(m->func.m_module);
-    Py_CLEAR(m->func_dict);
-    Py_CLEAR(m->func_name);
-    Py_CLEAR(m->func_doc);
-    Py_CLEAR(m->func_code);
-    Py_CLEAR(m->func_classobj);
-    Py_CLEAR(m->defaults_tuple);
-    if (m->defaults) {
-        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
-        int i;
-        for (i = 0; i < m->defaults_pyobjects; i++)
-            Py_XDECREF(pydefaults[i]);
-        PyMem_Free(m->defaults);
-        m->defaults = NULL;
-    }
-    return 0;
+    return (PyObject *)op;
 }
-static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
-{
+
+static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
     PyObject_GC_UnTrack(m);
-    if (m->func_weakreflist != NULL)
-        PyObject_ClearWeakRefs((PyObject *) m);
-    __Pyx_CyFunction_clear(m);
+    Py_XDECREF(m->func.m_self);
+    Py_XDECREF(m->func.m_module);
     PyObject_GC_Del(m);
 }
-static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
-{
-    Py_VISIT(m->func_closure);
-    Py_VISIT(m->func.m_module);
-    Py_VISIT(m->func_dict);
-    Py_VISIT(m->func_name);
-    Py_VISIT(m->func_doc);
-    Py_VISIT(m->func_code);
-    Py_VISIT(m->func_classobj);
-    Py_VISIT(m->defaults_tuple);
-    if (m->defaults) {
-        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
-        int i;
-        for (i = 0; i < m->defaults_pyobjects; i++)
-            Py_VISIT(pydefaults[i]);
-    }
-    return 0;
-}
-static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
-{
-    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
-        Py_INCREF(func);
-        return func;
-    }
-    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
-        if (type == NULL)
-            type = (PyObject *)(Py_TYPE(obj));
-        return PyMethod_New(func,
-                            type, (PyObject *)(Py_TYPE(type)));
-    }
+
+static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
     if (obj == Py_None)
-        obj = NULL;
+            obj = NULL;
     return PyMethod_New(func, obj, type);
 }
-static PyObject*
-__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
-{
-    PyObject *func_name = __Pyx_CyFunction_get_name(op);
-#if PY_MAJOR_VERSION >= 3
-    return PyUnicode_FromFormat("<cyfunction %U at %p>",
-                                func_name, (void *)op);
-#else
-    return PyString_FromFormat("<cyfunction %s at %p>",
-                               PyString_AsString(func_name), (void *)op);
-#endif
-}
-static PyTypeObject __pyx_CyFunctionType_type = {
-    PyVarObject_HEAD_INIT(0, 0)
-    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
-    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
-    0,                                  /*tp_itemsize*/
-    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
-    0,                                  /*tp_print*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
-#if PY_MAJOR_VERSION < 3
-    0,                                  /*tp_compare*/
-#else
-    0,                                  /*reserved*/
-#endif
-    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    0,                                  /*tp_as_sequence*/
-    0,                                  /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    __Pyx_PyCFunction_Call,             /*tp_call*/
-    0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
-    0,                                  /*tp_doc*/
-    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
-    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
-    0,                                  /*tp_iter*/
-    0,                                  /*tp_iternext*/
-    __pyx_CyFunction_methods,           /*tp_methods*/
-    __pyx_CyFunction_members,           /*tp_members*/
-    __pyx_CyFunction_getsets,           /*tp_getset*/
-    0,                                  /*tp_base*/
-    0,                                  /*tp_dict*/
-    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
-    0,                                  /*tp_descr_set*/
-    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
-    0,                                  /*tp_init*/
-    0,                                  /*tp_alloc*/
-    0,                                  /*tp_new*/
-    0,                                  /*tp_free*/
-    0,                                  /*tp_is_gc*/
-    0,                                  /*tp_bases*/
-    0,                                  /*tp_mro*/
-    0,                                  /*tp_cache*/
-    0,                                  /*tp_subclasses*/
-    0,                                  /*tp_weaklist*/
-    0,                                  /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
-    0,                                  /*tp_version_tag*/
-#endif
-};
-static int __Pyx_CyFunction_init(void)
-{
-    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
+
+static int __pyx_binding_PyCFunctionType_init(void) {
+    __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
+    __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
+    __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
+    __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
+    if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
         return -1;
-    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
+    }
+    __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
     return 0;
-}
-void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
-{
-    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-    m->defaults = PyMem_Malloc(size);
-    if (!m->defaults)
-        return PyErr_NoMemory();
-    memset(m->defaults, 0, sizeof(size));
-    m->defaults_pyobjects = pyobjects;
-    return m->defaults;
-}
-static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple)
-{
-    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-    m->defaults_tuple = tuple;
-    Py_INCREF(tuple);
+
 }
 
 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
-    if (s1 == s2) {
+    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
         return (equals == Py_EQ);
     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
         if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
@@ -43102,26 +40542,16 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq
 }
 
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
-    if (s1 == s2) {
+    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
         return (equals == Py_EQ);
     } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
-        #if CYTHON_PEP393_ENABLED
-        if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
-            return -1;
-        if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
-            return (equals == Py_NE);
-        } else if (PyUnicode_GET_LENGTH(s1) == 1) {
-            Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
-            Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
-            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
-        #else
         if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
             return (equals == Py_NE);
         } else if (PyUnicode_GET_SIZE(s1) == 1) {
-            Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
-            Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
-            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
-        #endif
+            if (equals == Py_EQ)
+                return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]);
+            else
+                return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]);
         } else {
             int result = PyUnicode_Compare(s1, s2);
             if ((result == -1) && unlikely(PyErr_Occurred()))
@@ -43954,79 +41384,86 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
+
     tmp_type = tstate->exc_type;
     tmp_value = tstate->exc_value;
     tmp_tb = tstate->exc_traceback;
+
     tstate->exc_type = *type;
     tstate->exc_value = *value;
     tstate->exc_traceback = *tb;
+
     *type = tmp_type;
     *value = tmp_value;
     *tb = tmp_tb;
 }
 
-static PyObject *__Pyx_Generator_Next(PyObject *self);
-static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
-static PyObject *__Pyx_Generator_Close(PyObject *self);
-static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
-static CYTHON_INLINE
-void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self)
+static CYTHON_INLINE void __Pyx_Generator_ExceptionClear(struct __pyx_Generator_object *self)
 {
-    PyObject *exc_type = self->exc_type;
-    PyObject *exc_value = self->exc_value;
-    PyObject *exc_traceback = self->exc_traceback;
+    Py_XDECREF(self->exc_type);
+    Py_XDECREF(self->exc_value);
+    Py_XDECREF(self->exc_traceback);
+
     self->exc_type = NULL;
     self->exc_value = NULL;
     self->exc_traceback = NULL;
-    Py_XDECREF(exc_type);
-    Py_XDECREF(exc_value);
-    Py_XDECREF(exc_traceback);
 }
-static CYTHON_INLINE
-PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value)
+
+static CYTHON_INLINE PyObject *__Pyx_Generator_SendEx(struct __pyx_Generator_object *self, PyObject *value)
 {
     PyObject *retval;
-    if (unlikely(self->is_running)) {
+
+    if (self->is_running) {
         PyErr_SetString(PyExc_ValueError,
                         "generator already executing");
         return NULL;
     }
-    if (unlikely(self->resume_label == 0)) {
-        if (unlikely(value && value != Py_None)) {
+
+    if (self->resume_label == 0) {
+        if (value && value != Py_None) {
             PyErr_SetString(PyExc_TypeError,
                             "can't send non-None value to a "
                             "just-started generator");
             return NULL;
         }
     }
-    if (unlikely(self->resume_label == -1)) {
+
+    if (self->resume_label == -1) {
         PyErr_SetNone(PyExc_StopIteration);
         return NULL;
     }
+
+
     if (value)
         __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
     else
         __Pyx_Generator_ExceptionClear(self);
+
     self->is_running = 1;
     retval = self->body((PyObject *) self, value);
     self->is_running = 0;
+
     if (retval)
         __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
     else
         __Pyx_Generator_ExceptionClear(self);
+
     return retval;
 }
+
 static PyObject *__Pyx_Generator_Next(PyObject *self)
 {
-    return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, Py_None);
+    return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, Py_None);
 }
+
 static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value)
 {
-    return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, value);
+    return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, value);
 }
+
 static PyObject *__Pyx_Generator_Close(PyObject *self)
 {
-    __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
+    struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self;
     PyObject *retval;
 #if PY_VERSION_HEX < 0x02050000
     PyErr_SetNone(PyExc_StopIteration);
@@ -44053,190 +41490,19 @@ static PyObject *__Pyx_Generator_Close(PyObject *self)
     }
     return NULL;
 }
-static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args)
+
+static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args, CYTHON_UNUSED PyObject *kwds)
 {
-    __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
+    struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self;
     PyObject *typ;
     PyObject *tb = NULL;
     PyObject *val = NULL;
+
     if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
         return NULL;
     __Pyx_Raise(typ, val, tb, NULL);
     return __Pyx_Generator_SendEx(generator, NULL);
 }
-static int
-__Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg)
-{
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
-    Py_VISIT(gen->closure);
-    Py_VISIT(gen->classobj);
-    Py_VISIT(gen->exc_type);
-    Py_VISIT(gen->exc_value);
-    Py_VISIT(gen->exc_traceback);
-    return 0;
-}
-static void
-__Pyx_Generator_dealloc(PyObject *self)
-{
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
-    PyObject_GC_UnTrack(gen);
-    if (gen->gi_weakreflist != NULL)
-        PyObject_ClearWeakRefs(self);
-    PyObject_GC_Track(self);
-    if (gen->resume_label > 0) {
-        Py_TYPE(gen)->tp_del(self);
-        if (self->ob_refcnt > 0)
-            return;                     /* resurrected.  :( */
-    }
-    PyObject_GC_UnTrack(self);
-    Py_CLEAR(gen->closure);
-    Py_CLEAR(gen->classobj);
-    Py_CLEAR(gen->exc_type);
-    Py_CLEAR(gen->exc_value);
-    Py_CLEAR(gen->exc_traceback);
-    PyObject_GC_Del(gen);
-}
-static void
-__Pyx_Generator_del(PyObject *self)
-{
-    PyObject *res;
-    PyObject *error_type, *error_value, *error_traceback;
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
-    if (gen->resume_label <= 0)
-        return ;
-    assert(self->ob_refcnt == 0);
-    self->ob_refcnt = 1;
-    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
-    res = __Pyx_Generator_Close(self);
-    if (res == NULL)
-        PyErr_WriteUnraisable(self);
-    else
-        Py_DECREF(res);
-    __Pyx_ErrRestore(error_type, error_value, error_traceback);
-    /* Undo the temporary resurrection; can't use DECREF here, it would
-     * cause a recursive call.
-     */
-    assert(self->ob_refcnt > 0);
-    if (--self->ob_refcnt == 0)
-        return; /* this is the normal path out */
-    /* close() resurrected it!  Make it look like the original Py_DECREF
-     * never happened.
-     */
-    {
-        Py_ssize_t refcnt = self->ob_refcnt;
-        _Py_NewReference(self);
-        self->ob_refcnt = refcnt;
-    }
-    assert(PyType_IS_GC(self->ob_type) &&
-           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
-    /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
-     * we need to undo that. */
-    _Py_DEC_REFTOTAL;
-    /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
-     * chain, so no more to do there.
-     * If COUNT_ALLOCS, the original decref bumped tp_frees, and
-     * _Py_NewReference bumped tp_allocs:  both of those need to be
-     * undone.
-     */
-#ifdef COUNT_ALLOCS
-    --self->ob_type->tp_frees;
-    --self->ob_type->tp_allocs;
-#endif
-}
-static PyMemberDef __pyx_Generator_memberlist[] = {
-    {(char *) "gi_running",
-     T_INT,
-     offsetof(__pyx_GeneratorObject, is_running),
-     READONLY,
-     NULL},
-    {0, 0, 0, 0, 0}
-};
-static PyMethodDef __pyx_Generator_methods[] = {
-    {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
-    {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
-    {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
-    {0, 0, 0, 0}
-};
-static PyTypeObject __pyx_GeneratorType = {
-    PyVarObject_HEAD_INIT(0, 0)
-    __Pyx_NAMESTR("generator"),         /*tp_name*/
-    sizeof(__pyx_GeneratorObject),      /*tp_basicsize*/
-    0,                                  /*tp_itemsize*/
-    (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/
-    0,                                  /*tp_print*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
-#if PY_MAJOR_VERSION < 3
-    0,                                  /*tp_compare*/
-#else
-    0,                                  /*reserved*/
-#endif
-    0,                                   /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    0,                                  /*tp_as_sequence*/
-    0,                                  /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    0,                                  /*tp_call*/
-    0,                                  /*tp_str*/
-    PyObject_GenericGetAttr,            /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
-    0,                                  /*tp_doc*/
-    (traverseproc) __Pyx_Generator_traverse,   /*tp_traverse*/
-    0,                                  /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
-    PyObject_SelfIter,                  /*tp_iter*/
-    (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
-    __pyx_Generator_methods,            /*tp_methods*/
-    __pyx_Generator_memberlist,         /*tp_members*/
-    0,                                  /*tp_getset*/
-    0,                                  /*tp_base*/
-    0,                                  /*tp_dict*/
-    0,                                  /*tp_descr_get*/
-    0,                                  /*tp_descr_set*/
-    0,                                  /*tp_dictoffset*/
-    0,                                  /*tp_init*/
-    0,                                  /*tp_alloc*/
-    0,                                  /*tp_new*/
-    0,                                  /*tp_free*/
-    0,                                  /*tp_is_gc*/
-    0,                                  /*tp_bases*/
-    0,                                  /*tp_mro*/
-    0,                                  /*tp_cache*/
-    0,                                  /*tp_subclasses*/
-    0,                                  /*tp_weaklist*/
-    __Pyx_Generator_del,                /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
-    0,                                  /*tp_version_tag*/
-#endif
-};
-static
-__pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
-                                           PyObject *closure)
-{
-    __pyx_GeneratorObject *gen =
-        PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType);
-    if (gen == NULL)
-        return NULL;
-    gen->body = body;
-    gen->closure = closure;
-    Py_XINCREF(closure);
-    gen->is_running = 0;
-    gen->resume_label = 0;
-    gen->classobj = NULL;
-    gen->exc_type = NULL;
-    gen->exc_value = NULL;
-    gen->exc_traceback = NULL;
-    gen->gi_weakreflist = NULL;
-    PyObject_GC_Track(gen);
-    return gen;
-}
-static int __pyx_Generator_init(void)
-{
-    return PyType_Ready(&__pyx_GeneratorType);
-}
 
 static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                   int lineno, const char *filename) {
@@ -44302,10 +41568,15 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
-    py_name = __Pyx_PyIdentifier_FromString(class_name);
+    #if PY_MAJOR_VERSION < 3
+    py_name = PyString_FromString(class_name);
+    #else
+    py_name = PyUnicode_FromString(class_name);
+    #endif
     if (!py_name)
         goto bad;
     result = PyObject_GetAttr(py_module, py_name);
@@ -44321,7 +41592,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+    if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -44331,7 +41602,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -44350,7 +41621,12 @@ bad:
 static PyObject *__Pyx_ImportModule(const char *name) {
     PyObject *py_name = 0;
     PyObject *py_module = 0;
-    py_name = __Pyx_PyIdentifier_FromString(name);
+
+    #if PY_MAJOR_VERSION < 3
+    py_name = PyString_FromString(name);
+    #else
+    py_name = PyUnicode_FromString(name);
+    #endif
     if (!py_name)
         goto bad;
     py_module = PyImport_Import(py_name);
@@ -44362,105 +41638,29 @@ bad:
 }
 #endif
 
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
-    int start = 0, mid = 0, end = count - 1;
-    if (end >= 0 && code_line > entries[end].code_line) {
-        return count;
-    }
-    while (start < end) {
-        mid = (start + end) / 2;
-        if (code_line < entries[mid].code_line) {
-            end = mid;
-        } else if (code_line > entries[mid].code_line) {
-             start = mid + 1;
-        } else {
-            return mid;
-        }
-    }
-    if (code_line <= entries[mid].code_line) {
-        return mid;
-    } else {
-        return mid + 1;
-    }
-}
-static PyCodeObject *__pyx_find_code_object(int code_line) {
-    PyCodeObject* code_object;
-    int pos;
-    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
-        return NULL;
-    }
-    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
-    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
-        return NULL;
-    }
-    code_object = __pyx_code_cache.entries[pos].code_object;
-    Py_INCREF(code_object);
-    return code_object;
-}
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
-    int pos, i;
-    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
-    if (unlikely(!code_line)) {
-        return;
-    }
-    if (unlikely(!entries)) {
-        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
-        if (likely(entries)) {
-            __pyx_code_cache.entries = entries;
-            __pyx_code_cache.max_count = 64;
-            __pyx_code_cache.count = 1;
-            entries[0].code_line = code_line;
-            entries[0].code_object = code_object;
-            Py_INCREF(code_object);
-        }
-        return;
-    }
-    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
-    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
-        PyCodeObject* tmp = entries[pos].code_object;
-        entries[pos].code_object = code_object;
-        Py_DECREF(tmp);
-        return;
-    }
-    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
-        int new_max = __pyx_code_cache.max_count + 64;
-        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
-            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
-        if (unlikely(!entries)) {
-            return;
-        }
-        __pyx_code_cache.entries = entries;
-        __pyx_code_cache.max_count = new_max;
-    }
-    for (i=__pyx_code_cache.count; i>pos; i--) {
-        entries[i] = entries[i-1];
-    }
-    entries[pos].code_line = code_line;
-    entries[pos].code_object = code_object;
-    __pyx_code_cache.count++;
-    Py_INCREF(code_object);
-}
-
 #include "compile.h"
 #include "frameobject.h"
 #include "traceback.h"
-static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
-            const char *funcname, int c_line,
-            int py_line, const char *filename) {
-    PyCodeObject *py_code = 0;
+
+static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
+                               int __pyx_lineno, const char *__pyx_filename) {
     PyObject *py_srcfile = 0;
     PyObject *py_funcname = 0;
+    PyObject *py_globals = 0;
+    PyCodeObject *py_code = 0;
+    PyFrameObject *py_frame = 0;
+
     #if PY_MAJOR_VERSION < 3
-    py_srcfile = PyString_FromString(filename);
+    py_srcfile = PyString_FromString(__pyx_filename);
     #else
-    py_srcfile = PyUnicode_FromString(filename);
+    py_srcfile = PyUnicode_FromString(__pyx_filename);
     #endif
     if (!py_srcfile) goto bad;
-    if (c_line) {
+    if (__pyx_clineno) {
         #if PY_MAJOR_VERSION < 3
-        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
         #else
-        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
         #endif
     }
     else {
@@ -44471,45 +41671,28 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
         #endif
     }
     if (!py_funcname) goto bad;
-    py_code = __Pyx_PyCode_New(
+    py_globals = PyModule_GetDict(__pyx_m);
+    if (!py_globals) goto bad;
+    py_code = PyCode_New(
         0,            /*int argcount,*/
+        #if PY_MAJOR_VERSION >= 3
         0,            /*int kwonlyargcount,*/
+        #endif
         0,            /*int nlocals,*/
         0,            /*int stacksize,*/
         0,            /*int flags,*/
         __pyx_empty_bytes, /*PyObject *code,*/
-        __pyx_empty_tuple, /*PyObject *consts,*/
-        __pyx_empty_tuple, /*PyObject *names,*/
-        __pyx_empty_tuple, /*PyObject *varnames,*/
-        __pyx_empty_tuple, /*PyObject *freevars,*/
-        __pyx_empty_tuple, /*PyObject *cellvars,*/
+        __pyx_empty_tuple,  /*PyObject *consts,*/
+        __pyx_empty_tuple,  /*PyObject *names,*/
+        __pyx_empty_tuple,  /*PyObject *varnames,*/
+        __pyx_empty_tuple,  /*PyObject *freevars,*/
+        __pyx_empty_tuple,  /*PyObject *cellvars,*/
         py_srcfile,   /*PyObject *filename,*/
         py_funcname,  /*PyObject *name,*/
-        py_line,      /*int firstlineno,*/
+        __pyx_lineno,   /*int firstlineno,*/
         __pyx_empty_bytes  /*PyObject *lnotab*/
     );
-    Py_DECREF(py_srcfile);
-    Py_DECREF(py_funcname);
-    return py_code;
-bad:
-    Py_XDECREF(py_srcfile);
-    Py_XDECREF(py_funcname);
-    return NULL;
-}
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
-                               int py_line, const char *filename) {
-    PyCodeObject *py_code = 0;
-    PyObject *py_globals = 0;
-    PyFrameObject *py_frame = 0;
-    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
-    if (!py_code) {
-        py_code = __Pyx_CreateCodeObjectForTraceback(
-            funcname, c_line, py_line, filename);
-        if (!py_code) goto bad;
-        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
-    }
-    py_globals = PyModule_GetDict(__pyx_m);
-    if (!py_globals) goto bad;
+    if (!py_code) goto bad;
     py_frame = PyFrame_New(
         PyThreadState_GET(), /*PyThreadState *tstate,*/
         py_code,             /*PyCodeObject *code,*/
@@ -44517,9 +41700,11 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
         0                    /*PyObject *locals*/
     );
     if (!py_frame) goto bad;
-    py_frame->f_lineno = py_line;
+    py_frame->f_lineno = __pyx_lineno;
     PyTraceBack_Here(py_frame);
 bad:
+    Py_XDECREF(py_srcfile);
+    Py_XDECREF(py_funcname);
     Py_XDECREF(py_code);
     Py_XDECREF(py_frame);
 }
@@ -44554,7 +41739,6 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
 /* Type Conversion Functions */
 
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
diff --git a/pysam/csamtools.pyx b/pysam/csamtools.pyx
index 7dd075c..e300c66 100644
--- a/pysam/csamtools.pyx
+++ b/pysam/csamtools.pyx
@@ -357,14 +357,14 @@ VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" )
 VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
                         "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
                         "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, 
-                                 "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str },
-                        "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
+                                 "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str, "PG" : str,},
+                        "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str }, }
 
 # output order of fields within records
 VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
-                       "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
-                       "PG" : ( "PN", "ID", "VN", "CL" ), }
+                       "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
+                       "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
 
 
 ######################################################################
diff --git a/pysam/ctabix.c b/pysam/ctabix.c
index 9ab49e7..005213c 100644
--- a/pysam/ctabix.c
+++ b/pysam/ctabix.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17.1 on Tue Nov 20 16:47:00 2012 */
+/* Generated by Cython 0.17.4 on Mon Jan 14 21:45:57 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -53,12 +53,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -355,21 +358,21 @@ static const char *__pyx_f[] = {
 
 /*--- Type declarations ---*/
 struct __pyx_obj_6ctabix_Parser;
-struct __pyx_obj_6ctabix_asVCF;
+struct __pyx_obj_6ctabix_asGTF;
+struct __pyx_obj_6ctabix_Tabixfile;
 struct __pyx_obj_10TabProxies_TupleProxy;
 struct __pyx_obj_10TabProxies_NamedTupleProxy;
-struct __pyx_obj_10TabProxies_BedProxy;
-struct __pyx_obj_6ctabix_tabix_copy_iterator;
 struct __pyx_obj_10TabProxies_VCFProxy;
-struct __pyx_obj_10TabProxies_GTFProxy;
-struct __pyx_obj_6ctabix_TabixIterator;
+struct __pyx_obj_6ctabix_tabix_inplace_iterator;
+struct __pyx_obj_6ctabix_tabix_copy_iterator;
 struct __pyx_obj_6ctabix_TabixIteratorParsed;
+struct __pyx_obj_10TabProxies_BedProxy;
 struct __pyx_obj_6ctabix_TabixHeaderIterator;
-struct __pyx_obj_6ctabix_Tabixfile;
-struct __pyx_obj_6ctabix_asGTF;
-struct __pyx_obj_6ctabix_asBed;
-struct __pyx_obj_6ctabix_tabix_inplace_iterator;
 struct __pyx_obj_6ctabix_asTuple;
+struct __pyx_obj_10TabProxies_GTFProxy;
+struct __pyx_obj_6ctabix_asBed;
+struct __pyx_obj_6ctabix_TabixIterator;
+struct __pyx_obj_6ctabix_asVCF;
 
 /* "ctabix.pxd":190
  *     cdef tabix_t * tabixfile
@@ -383,18 +386,33 @@ struct __pyx_obj_6ctabix_Parser {
 };
 
 
-/* "ctabix.pxd":202
+/* "ctabix.pxd":196
  *      pass
  * 
- * cdef class asVCF(Parser):             # <<<<<<<<<<<<<<
+ * cdef class asGTF(Parser):             # <<<<<<<<<<<<<<
  *      pass
  * 
  */
-struct __pyx_obj_6ctabix_asVCF {
+struct __pyx_obj_6ctabix_asGTF {
   struct __pyx_obj_6ctabix_Parser __pyx_base;
 };
 
 
+/* "ctabix.pxd":172
+ *   # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
+ * 
+ * cdef class Tabixfile:             # <<<<<<<<<<<<<<
+ * 
+ *     # pointer to tabixfile
+ */
+struct __pyx_obj_6ctabix_Tabixfile {
+  PyObject_HEAD
+  tabix_t *tabixfile;
+  int isremote;
+  char *_filename;
+};
+
+
 /* "TabProxies.pxd":41
  *   ctypedef int uint64_t
  * 
@@ -427,37 +445,6 @@ struct __pyx_obj_10TabProxies_NamedTupleProxy {
 };
 
 
-/* "TabProxies.pxd":72
- *     pass
- * 
- * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
- * 
- *     cdef:
- */
-struct __pyx_obj_10TabProxies_BedProxy {
-  struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
-  char *contig;
-  uint32_t start;
-  uint32_t end;
-  int bedfields;
-};
-
-
-/* "ctabix.pxd":218
- *     cdef __cnext__(self)
- * 
- * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
- *     cdef FILE * infile
- *     cdef Parser parser
- */
-struct __pyx_obj_6ctabix_tabix_copy_iterator {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtab;
-  FILE *infile;
-  struct __pyx_obj_6ctabix_Parser *parser;
-};
-
-
 /* "TabProxies.pxd":83
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
@@ -472,31 +459,35 @@ struct __pyx_obj_10TabProxies_VCFProxy {
 };
 
 
-/* "TabProxies.pxd":60
- *     cdef update( self, char * buffer, size_t nbytes )
- * 
- * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
+/* "ctabix.pxd":210
+ *     cdef Parser parser
  * 
- *     cdef:
+ * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
+ *     cdef FILE * infile
+ *     cdef char * buffer
  */
-struct __pyx_obj_10TabProxies_GTFProxy {
-  struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
-  char *_attributes;
-  int hasOwnAttributes;
+struct __pyx_obj_6ctabix_tabix_inplace_iterator {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtab;
+  FILE *infile;
+  char *buffer;
+  size_t size;
+  struct __pyx_obj_6ctabix_Parser *parser;
 };
 
 
-/* "ctabix.pxd":182
- *     cdef char * _filename
+/* "ctabix.pxd":218
+ *     cdef __cnext__(self)
  * 
- * cdef class TabixIterator:             # <<<<<<<<<<<<<<
- *     cdef ti_iter_t iterator
- *     cdef tabix_t * tabixfile
+ * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
+ *     cdef FILE * infile
+ *     cdef Parser parser
  */
-struct __pyx_obj_6ctabix_TabixIterator {
+struct __pyx_obj_6ctabix_tabix_copy_iterator {
   PyObject_HEAD
-  ti_iter_t iterator;
-  tabix_t *tabixfile;
+  struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtab;
+  FILE *infile;
+  struct __pyx_obj_6ctabix_Parser *parser;
 };
 
 
@@ -515,6 +506,22 @@ struct __pyx_obj_6ctabix_TabixIteratorParsed {
 };
 
 
+/* "TabProxies.pxd":72
+ *     pass
+ * 
+ * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
+ * 
+ *     cdef:
+ */
+struct __pyx_obj_10TabProxies_BedProxy {
+  struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
+  char *contig;
+  uint32_t start;
+  uint32_t end;
+  int bedfields;
+};
+
+
 /* "ctabix.pxd":186
  *     cdef tabix_t * tabixfile
  * 
@@ -529,30 +536,29 @@ struct __pyx_obj_6ctabix_TabixHeaderIterator {
 };
 
 
-/* "ctabix.pxd":172
- *   # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
+/* "ctabix.pxd":193
+ *      pass
  * 
- * cdef class Tabixfile:             # <<<<<<<<<<<<<<
+ * cdef class asTuple(Parser):             # <<<<<<<<<<<<<<
+ *      pass
  * 
- *     # pointer to tabixfile
  */
-struct __pyx_obj_6ctabix_Tabixfile {
-  PyObject_HEAD
-  tabix_t *tabixfile;
-  int isremote;
-  char *_filename;
+struct __pyx_obj_6ctabix_asTuple {
+  struct __pyx_obj_6ctabix_Parser __pyx_base;
 };
 
 
-/* "ctabix.pxd":196
- *      pass
+/* "TabProxies.pxd":60
+ *     cdef update( self, char * buffer, size_t nbytes )
  * 
- * cdef class asGTF(Parser):             # <<<<<<<<<<<<<<
- *      pass
+ * cdef class GTFProxy( TupleProxy) :             # <<<<<<<<<<<<<<
  * 
+ *     cdef:
  */
-struct __pyx_obj_6ctabix_asGTF {
-  struct __pyx_obj_6ctabix_Parser __pyx_base;
+struct __pyx_obj_10TabProxies_GTFProxy {
+  struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
+  char *_attributes;
+  int hasOwnAttributes;
 };
 
 
@@ -568,50 +574,33 @@ struct __pyx_obj_6ctabix_asBed {
 };
 
 
-/* "ctabix.pxd":210
- *     cdef Parser parser
+/* "ctabix.pxd":182
+ *     cdef char * _filename
  * 
- * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
- *     cdef FILE * infile
- *     cdef char * buffer
+ * cdef class TabixIterator:             # <<<<<<<<<<<<<<
+ *     cdef ti_iter_t iterator
+ *     cdef tabix_t * tabixfile
  */
-struct __pyx_obj_6ctabix_tabix_inplace_iterator {
+struct __pyx_obj_6ctabix_TabixIterator {
   PyObject_HEAD
-  struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtab;
-  FILE *infile;
-  char *buffer;
-  size_t size;
-  struct __pyx_obj_6ctabix_Parser *parser;
+  ti_iter_t iterator;
+  tabix_t *tabixfile;
 };
 
 
-/* "ctabix.pxd":193
+/* "ctabix.pxd":202
  *      pass
  * 
- * cdef class asTuple(Parser):             # <<<<<<<<<<<<<<
+ * cdef class asVCF(Parser):             # <<<<<<<<<<<<<<
  *      pass
  * 
  */
-struct __pyx_obj_6ctabix_asTuple {
+struct __pyx_obj_6ctabix_asVCF {
   struct __pyx_obj_6ctabix_Parser __pyx_base;
 };
 
 
 
-/* "ctabix.pyx":768
- *         return self.__cnext__()
- * 
- * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
- *     '''iterate over ``infile``.
- * 
- */
-
-struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator {
-  PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_copy_iterator *);
-};
-static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtabptr_6ctabix_tabix_copy_iterator;
-
-
 /* "TabProxies.pxd":41
  *   ctypedef int uint64_t
  * 
@@ -644,18 +633,32 @@ struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
 
 
-/* "TabProxies.pxd":83
- *     cdef update( self, char * buffer, size_t nbytes )
+/* "TabProxies.pxd":72
+ *     pass
  * 
- * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
+ * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
  * 
  *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_VCFProxy {
+struct __pyx_vtabstruct_10TabProxies_BedProxy {
   struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
 };
-static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
+static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy;
+
+
+/* "ctabix.pyx":709
+ * ## Iterators for parsing through unindexed files.
+ * #########################################################
+ * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
+ *     '''iterate over ``infile``.
+ * 
+ */
+
+struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator {
+  PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_inplace_iterator *);
+};
+static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_6ctabix_tabix_inplace_iterator;
 
 
 /* "TabProxies.pxd":60
@@ -673,32 +676,32 @@ struct __pyx_vtabstruct_10TabProxies_GTFProxy {
 static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy;
 
 
-/* "TabProxies.pxd":72
- *     pass
+/* "ctabix.pyx":771
+ *         return self.__cnext__()
  * 
- * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
+ * ctypedef class tabix_copy_iterator:             # <<<<<<<<<<<<<<
+ *     '''iterate over ``infile``.
  * 
- *     cdef:
  */
 
-struct __pyx_vtabstruct_10TabProxies_BedProxy {
-  struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
+struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator {
+  PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_copy_iterator *);
 };
-static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy;
+static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtabptr_6ctabix_tabix_copy_iterator;
 
 
-/* "ctabix.pyx":706
- * ## Iterators for parsing through unindexed files.
- * #########################################################
- * ctypedef class tabix_inplace_iterator:             # <<<<<<<<<<<<<<
- *     '''iterate over ``infile``.
+/* "TabProxies.pxd":83
+ *     cdef update( self, char * buffer, size_t nbytes )
+ * 
+ * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
  * 
+ *     cdef:
  */
 
-struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator {
-  PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_inplace_iterator *);
+struct __pyx_vtabstruct_10TabProxies_VCFProxy {
+  struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
 };
-static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_6ctabix_tabix_inplace_iterator;
+static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
 #ifndef CYTHON_REFNANNY
   #define CYTHON_REFNANNY 0
 #endif
@@ -1196,20 +1199,21 @@ static char __pyx_k_34[] = "could not open '%s' for reading";
 static char __pyx_k_36[] = "writing failed";
 static char __pyx_k_40[] = "#";
 static char __pyx_k_42[] = "No such file '%s'";
-static char __pyx_k_43[] = ".gz";
-static char __pyx_k_45[] = "Filename '%s.tbi' already exists, use *force* to overwrite";
-static char __pyx_k_47[] = "unknown preset '%s', valid presets are '%s'";
-static char __pyx_k_48[] = ",";
-static char __pyx_k_49[] = "I/O operation on closed file.";
-static char __pyx_k_52[] = "incomplete line at %s";
-static char __pyx_k_56[] = "tabix_generic_iterator";
-static char __pyx_k_57[] = "filename associated with this object.";
-static char __pyx_k_58[] = "the file header.\n          \n        .. note::\n            The header is returned as an iterator over lines without the\n            newline character.\n        ";
-static char __pyx_k_59[] = "chromosome names";
-static char __pyx_k_60[] = "getfilesystemencoding";
-static char __pyx_k_63[] = "/ifs/devel/pysam/pysam/ctabix.pyx";
-static char __pyx_k_74[] = "iterate over ``infile``.\n    \n    Permits the use of file-like objects for example from the gzip module.\n    ";
-static char __pyx_k_77[] = "tabix_inplace_iterator";
+static char __pyx_k_43[] = "neither preset nor seq_col,start_col and end_col given";
+static char __pyx_k_45[] = ".gz";
+static char __pyx_k_47[] = "Filename '%s.tbi' already exists, use *force* to overwrite";
+static char __pyx_k_49[] = "unknown preset '%s', valid presets are '%s'";
+static char __pyx_k_50[] = ",";
+static char __pyx_k_51[] = "I/O operation on closed file.";
+static char __pyx_k_54[] = "incomplete line at %s";
+static char __pyx_k_58[] = "tabix_generic_iterator";
+static char __pyx_k_59[] = "filename associated with this object.";
+static char __pyx_k_60[] = "the file header.\n          \n        .. note::\n            The header is returned as an iterator over lines without the\n            newline character.\n        ";
+static char __pyx_k_61[] = "chromosome names";
+static char __pyx_k_62[] = "getfilesystemencoding";
+static char __pyx_k_65[] = "/home/andreas/devel/pysam/pysam/ctabix.pyx";
+static char __pyx_k_76[] = "iterate over ``infile``.\n    \n    Permits the use of file-like objects for example from the gzip module.\n    ";
+static char __pyx_k_79[] = "tabix_inplace_iterator";
 static char __pyx_k__b[] = "b";
 static char __pyx_k__c[] = "c";
 static char __pyx_k__r[] = "r";
@@ -1331,17 +1335,18 @@ static PyObject *__pyx_kp_s_42;
 static PyObject *__pyx_kp_s_43;
 static PyObject *__pyx_kp_s_45;
 static PyObject *__pyx_kp_s_47;
-static PyObject *__pyx_kp_s_48;
 static PyObject *__pyx_kp_s_49;
 static PyObject *__pyx_kp_s_5;
-static PyObject *__pyx_kp_s_52;
-static PyObject *__pyx_n_s_56;
+static PyObject *__pyx_kp_s_50;
+static PyObject *__pyx_kp_s_51;
+static PyObject *__pyx_kp_s_54;
+static PyObject *__pyx_n_s_58;
 static PyObject *__pyx_kp_s_6;
-static PyObject *__pyx_n_s_60;
-static PyObject *__pyx_kp_s_63;
+static PyObject *__pyx_n_s_62;
+static PyObject *__pyx_kp_s_65;
 static PyObject *__pyx_kp_s_7;
-static PyObject *__pyx_kp_s_74;
-static PyObject *__pyx_n_s_77;
+static PyObject *__pyx_kp_s_76;
+static PyObject *__pyx_n_s_79;
 static PyObject *__pyx_kp_s_9;
 static PyObject *__pyx_n_s__IOError;
 static PyObject *__pyx_n_s__KeyError;
@@ -1473,25 +1478,26 @@ static PyObject *__pyx_k_tuple_37;
 static PyObject *__pyx_k_tuple_38;
 static PyObject *__pyx_k_tuple_44;
 static PyObject *__pyx_k_tuple_46;
-static PyObject *__pyx_k_tuple_50;
-static PyObject *__pyx_k_tuple_51;
+static PyObject *__pyx_k_tuple_48;
+static PyObject *__pyx_k_tuple_52;
 static PyObject *__pyx_k_tuple_53;
-static PyObject *__pyx_k_tuple_54;
 static PyObject *__pyx_k_tuple_55;
-static PyObject *__pyx_k_tuple_61;
-static PyObject *__pyx_k_tuple_64;
+static PyObject *__pyx_k_tuple_56;
+static PyObject *__pyx_k_tuple_57;
+static PyObject *__pyx_k_tuple_63;
 static PyObject *__pyx_k_tuple_66;
 static PyObject *__pyx_k_tuple_68;
 static PyObject *__pyx_k_tuple_70;
 static PyObject *__pyx_k_tuple_72;
-static PyObject *__pyx_k_tuple_75;
-static PyObject *__pyx_k_codeobj_62;
-static PyObject *__pyx_k_codeobj_65;
+static PyObject *__pyx_k_tuple_74;
+static PyObject *__pyx_k_tuple_77;
+static PyObject *__pyx_k_codeobj_64;
 static PyObject *__pyx_k_codeobj_67;
 static PyObject *__pyx_k_codeobj_69;
 static PyObject *__pyx_k_codeobj_71;
 static PyObject *__pyx_k_codeobj_73;
-static PyObject *__pyx_k_codeobj_76;
+static PyObject *__pyx_k_codeobj_75;
+static PyObject *__pyx_k_codeobj_78;
 
 /* "ctabix.pyx":19
  * from cpython.version cimport PY_MAJOR_VERSION
@@ -4319,6 +4325,7 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
+  tabix_t *__pyx_t_4;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -4352,7 +4359,8 @@ static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_T
  * 
  *         if tid < 0:
  */
-  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
+  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
+  __pyx_v_self->tabixfile = __pyx_t_4;
 
   /* "ctabix.pyx":293
  *         self.tabixfile = tabixfile.tabixfile
@@ -4713,6 +4721,7 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ct
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
+  tabix_t *__pyx_t_4;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -4746,7 +4755,8 @@ static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ct
  * 
  *         self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
  */
-  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
+  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
+  __pyx_v_self->tabixfile = __pyx_t_4;
 
   /* "ctabix.pyx":344
  *         self.tabixfile = tabixfile.tabixfile
@@ -5576,6 +5586,7 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
+  tabix_t *__pyx_t_4;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -5622,7 +5633,8 @@ static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ct
  * 
  *         if tid < 0:
  */
-  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
+  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
+  __pyx_v_self->tabixfile = __pyx_t_4;
 
   /* "ctabix.pyx":530
  *         self.tabixfile = tabixfile.tabixfile
@@ -6512,23 +6524,25 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   PyObject *__pyx_t_3 = NULL;
   int __pyx_t_4;
   int __pyx_t_5;
-  PyObject *__pyx_t_6 = NULL;
+  int __pyx_t_6;
   int __pyx_t_7;
-  PyObject *__pyx_t_8 = NULL;
+  int __pyx_t_8;
   PyObject *__pyx_t_9 = NULL;
   PyObject *__pyx_t_10 = NULL;
-  int __pyx_t_11;
+  PyObject *__pyx_t_11 = NULL;
   PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
+  int __pyx_t_13;
   PyObject *__pyx_t_14 = NULL;
-  PyObject *(*__pyx_t_15)(PyObject *);
-  int32_t __pyx_t_16;
-  int32_t __pyx_t_17;
+  PyObject *__pyx_t_15 = NULL;
+  PyObject *__pyx_t_16 = NULL;
+  PyObject *(*__pyx_t_17)(PyObject *);
   int32_t __pyx_t_18;
   int32_t __pyx_t_19;
   int32_t __pyx_t_20;
   int32_t __pyx_t_21;
-  char *__pyx_t_22;
+  int32_t __pyx_t_22;
+  int32_t __pyx_t_23;
+  char *__pyx_t_24;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -6542,7 +6556,7 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
  * 
  *     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)             # <<<<<<<<<<<<<<
  * 
- *     if not filename.endswith(".gz"):
+ *     if preset == None and (seq_col == None or start_col == None or end_col == None):
  */
   __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -6585,32 +6599,84 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   /* "ctabix.pyx":655
  *     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
  * 
- *     if not filename.endswith(".gz"):             # <<<<<<<<<<<<<<
- *         tabix_compress( filename, filename + ".gz", force = force )
- *         os.unlink( filename )
+ *     if preset == None and (seq_col == None or start_col == None or end_col == None):             # <<<<<<<<<<<<<<
+ *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )
+ * 
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__endswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_preset, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = (!__pyx_t_5);
+  if (__pyx_t_5) {
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_seq_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    if (!__pyx_t_4) {
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_start_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (!__pyx_t_6) {
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_8 = __pyx_t_7;
+      } else {
+        __pyx_t_8 = __pyx_t_6;
+      }
+      __pyx_t_6 = __pyx_t_8;
+    } else {
+      __pyx_t_6 = __pyx_t_4;
+    }
+    __pyx_t_4 = __pyx_t_6;
+  } else {
+    __pyx_t_4 = __pyx_t_5;
+  }
   if (__pyx_t_4) {
 
     /* "ctabix.pyx":656
  * 
+ *     if preset == None and (seq_col == None or start_col == None or end_col == None):
+ *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )             # <<<<<<<<<<<<<<
+ * 
+ *     if not filename.endswith(".gz"):
+ */
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L4;
+  }
+  __pyx_L4:;
+
+  /* "ctabix.pyx":658
+ *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )
+ * 
+ *     if not filename.endswith(".gz"):             # <<<<<<<<<<<<<<
+ *         tabix_compress( filename, filename + ".gz", force = force )
+ *         os.unlink( filename )
+ */
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__endswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_5 = (!__pyx_t_4);
+  if (__pyx_t_5) {
+
+    /* "ctabix.pyx":659
+ * 
  *     if not filename.endswith(".gz"):
  *         tabix_compress( filename, filename + ".gz", force = force )             # <<<<<<<<<<<<<<
  *         os.unlink( filename )
  *         filename += ".gz"
  */
-    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__tabix_compress); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__tabix_compress); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_43)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_v_filename);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
@@ -6618,126 +6684,126 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__force), __pyx_v_force) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__force), __pyx_v_force) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-    /* "ctabix.pyx":657
+    /* "ctabix.pyx":660
  *     if not filename.endswith(".gz"):
  *         tabix_compress( filename, filename + ".gz", force = force )
  *         os.unlink( filename )             # <<<<<<<<<<<<<<
  *         filename += ".gz"
  * 
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__unlink); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__unlink); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_INCREF(__pyx_v_filename);
-    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filename);
+    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_filename);
     __Pyx_GIVEREF(__pyx_v_filename);
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "ctabix.pyx":658
+    /* "ctabix.pyx":661
  *         tabix_compress( filename, filename + ".gz", force = force )
  *         os.unlink( filename )
  *         filename += ".gz"             # <<<<<<<<<<<<<<
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):
  */
-    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_filename, ((PyObject *)__pyx_kp_s_43)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_filename, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_v_filename);
     __pyx_v_filename = __pyx_t_1;
     __pyx_t_1 = 0;
-    goto __pyx_L4;
+    goto __pyx_L5;
   }
-  __pyx_L4:;
+  __pyx_L5:;
 
-  /* "ctabix.pyx":660
+  /* "ctabix.pyx":663
  *         filename += ".gz"
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):             # <<<<<<<<<<<<<<
  *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )
  * 
  */
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = (!__pyx_t_4);
-  if (__pyx_t_5) {
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = (!__pyx_t_5);
+  if (__pyx_t_4) {
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
-    __Pyx_GIVEREF(__pyx_t_6);
-    __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
+    __Pyx_GIVEREF(__pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_7 = __pyx_t_4;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_7 = __pyx_t_5;
+    __pyx_t_6 = __pyx_t_4;
   }
-  if (__pyx_t_7) {
+  if (__pyx_t_6) {
 
-    /* "ctabix.pyx":661
+    /* "ctabix.pyx":664
  * 
  *     if not force and os.path.exists(filename + ".tbi" ):
  *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )             # <<<<<<<<<<<<<<
  * 
  *     # columns (1-based)
  */
-    __pyx_t_6 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L5;
+    __pyx_t_9 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L6;
   }
-  __pyx_L5:;
+  __pyx_L6:;
 
-  /* "ctabix.pyx":666
+  /* "ctabix.pyx":669
  *     # preset-code, contig, start, end, metachar for commends, lines to ignore at beginning
  *     # 0 is a missing column
  *     preset2conf = {             # <<<<<<<<<<<<<<
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  */
-  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
 
-  /* "ctabix.pyx":667
+  /* "ctabix.pyx":670
  *     # 0 is a missing column
  *     preset2conf = {
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  */
-  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
@@ -6757,17 +6823,17 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__gff), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__gff), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":668
+  /* "ctabix.pyx":671
  *     preset2conf = {
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  */
-  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_65536);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_65536);
@@ -6787,17 +6853,17 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__bed), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__bed), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":669
+  /* "ctabix.pyx":672
  *         'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
  */
-  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_65536);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_65536);
@@ -6817,17 +6883,17 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__psltbl), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__psltbl), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":670
+  /* "ctabix.pyx":673
  *         'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
  *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),
  */
-  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_1);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1);
@@ -6847,17 +6913,17 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__sam), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__sam), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":671
+  /* "ctabix.pyx":674
  *         'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),
  *         }
  */
-  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_2);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_2);
@@ -6877,17 +6943,17 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__vcf), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__vcf), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":672
+  /* "ctabix.pyx":675
  *         'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
  *         'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
  *         'pileup': (3, 1, 2, 0, ord('#'), 0 ),             # <<<<<<<<<<<<<<
  *         }
  * 
  */
-  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_INCREF(__pyx_int_3);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
@@ -6907,22 +6973,22 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_INCREF(__pyx_int_0);
   PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
   __Pyx_GIVEREF(__pyx_int_0);
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__pileup), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__pileup), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __pyx_v_preset2conf = __pyx_t_6;
-  __pyx_t_6 = 0;
+  __pyx_v_preset2conf = __pyx_t_9;
+  __pyx_t_9 = 0;
 
-  /* "ctabix.pyx":675
+  /* "ctabix.pyx":678
  *         }
  * 
  *     if preset:             # <<<<<<<<<<<<<<
  *         try:
  *             conf_data = preset2conf[preset]
  */
-  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_preset); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_7) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_preset); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
-    /* "ctabix.pyx":676
+    /* "ctabix.pyx":679
  * 
  *     if preset:
  *         try:             # <<<<<<<<<<<<<<
@@ -6930,132 +6996,132 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
  *         except KeyError:
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
-      __Pyx_XGOTREF(__pyx_t_8);
-      __Pyx_XGOTREF(__pyx_t_9);
+      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
       __Pyx_XGOTREF(__pyx_t_10);
+      __Pyx_XGOTREF(__pyx_t_11);
+      __Pyx_XGOTREF(__pyx_t_12);
       /*try:*/ {
 
-        /* "ctabix.pyx":677
+        /* "ctabix.pyx":680
  *     if preset:
  *         try:
  *             conf_data = preset2conf[preset]             # <<<<<<<<<<<<<<
  *         except KeyError:
  *             raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
  */
-        __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_preset2conf), __pyx_v_preset); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
-        __Pyx_GOTREF(__pyx_t_6);
-        __pyx_v_conf_data = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_preset2conf), __pyx_v_preset); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_v_conf_data = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
-      goto __pyx_L14_try_end;
-      __pyx_L7_error:;
+      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+      goto __pyx_L15_try_end;
+      __pyx_L8_error:;
       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-      /* "ctabix.pyx":678
+      /* "ctabix.pyx":681
  *         try:
  *             conf_data = preset2conf[preset]
  *         except KeyError:             # <<<<<<<<<<<<<<
  *             raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
  *     else:
  */
-      __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
-      if (__pyx_t_11) {
+      __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
+      if (__pyx_t_13) {
         __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(__pyx_t_6);
+        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_GOTREF(__pyx_t_1);
 
-        /* "ctabix.pyx":679
+        /* "ctabix.pyx":682
  *             conf_data = preset2conf[preset]
  *         except KeyError:
  *             raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))             # <<<<<<<<<<<<<<
  *     else:
  *         if end_col == None: end_col = -1
  */
-        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_48), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_50), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_12 = PyDict_Keys(__pyx_v_preset2conf); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(__pyx_t_12);
-        __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(__pyx_t_13);
-        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
-        __Pyx_GIVEREF(__pyx_t_12);
-        __pyx_t_12 = 0;
-        __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(__pyx_t_12);
+        __pyx_t_14 = PyDict_Keys(__pyx_v_preset2conf); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_GOTREF(__pyx_t_14);
+        __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_GOTREF(__pyx_t_15);
+        PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14);
+        __Pyx_GIVEREF(__pyx_t_14);
+        __pyx_t_14 = 0;
+        __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_GOTREF(__pyx_t_14);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(__pyx_t_13);
+        __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+        __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_GOTREF(__pyx_t_15);
         __Pyx_INCREF(__pyx_v_preset);
-        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_preset);
+        PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_preset);
         __Pyx_GIVEREF(__pyx_v_preset);
-        PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
-        __Pyx_GIVEREF(__pyx_t_12);
-        __pyx_t_12 = 0;
-        __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_12));
-        __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-        __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(__pyx_t_13);
-        PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
-        __pyx_t_12 = 0;
-        __pyx_t_12 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_GOTREF(__pyx_t_12);
-        __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-        __Pyx_Raise(__pyx_t_12, 0, 0, 0);
-        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_14);
+        __Pyx_GIVEREF(__pyx_t_14);
+        __pyx_t_14 = 0;
+        __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_14));
+        __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+        __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_GOTREF(__pyx_t_15);
+        PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_t_14));
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
+        __pyx_t_14 = 0;
+        __pyx_t_14 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_GOTREF(__pyx_t_14);
+        __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
+        __Pyx_Raise(__pyx_t_14, 0, 0, 0);
+        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        goto __pyx_L8_exception_handled;
+        goto __pyx_L9_exception_handled;
       }
-      __pyx_L9_except_error:;
-      __Pyx_XGIVEREF(__pyx_t_8);
-      __Pyx_XGIVEREF(__pyx_t_9);
+      __pyx_L10_except_error:;
       __Pyx_XGIVEREF(__pyx_t_10);
-      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+      __Pyx_XGIVEREF(__pyx_t_11);
+      __Pyx_XGIVEREF(__pyx_t_12);
+      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
       goto __pyx_L1_error;
-      __pyx_L8_exception_handled:;
-      __Pyx_XGIVEREF(__pyx_t_8);
-      __Pyx_XGIVEREF(__pyx_t_9);
+      __pyx_L9_exception_handled:;
       __Pyx_XGIVEREF(__pyx_t_10);
-      __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
-      __pyx_L14_try_end:;
+      __Pyx_XGIVEREF(__pyx_t_11);
+      __Pyx_XGIVEREF(__pyx_t_12);
+      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+      __pyx_L15_try_end:;
     }
-    goto __pyx_L6;
+    goto __pyx_L7;
   }
   /*else*/ {
 
-    /* "ctabix.pyx":681
+    /* "ctabix.pyx":684
  *             raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
  *     else:
  *         if end_col == None: end_col = -1             # <<<<<<<<<<<<<<
  *         preset = 0
  * 
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (__pyx_t_7) {
+    if (__pyx_t_6) {
       __Pyx_INCREF(__pyx_int_neg_1);
       __Pyx_DECREF(__pyx_v_end_col);
       __pyx_v_end_col = __pyx_int_neg_1;
-      goto __pyx_L17;
+      goto __pyx_L18;
     }
-    __pyx_L17:;
+    __pyx_L18:;
 
-    /* "ctabix.pyx":682
+    /* "ctabix.pyx":685
  *     else:
  *         if end_col == None: end_col = -1
  *         preset = 0             # <<<<<<<<<<<<<<
@@ -7066,71 +7132,71 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     __Pyx_DECREF(__pyx_v_preset);
     __pyx_v_preset = __pyx_int_0;
 
-    /* "ctabix.pyx":689
+    /* "ctabix.pyx":692
  *         # -1 is subtracted from the start coordinate. To avoid doing this, set
  *         # the TI_FLAG_UCSC=0x10000 flag:
  *         if zerobased: preset = preset | 0x10000             # <<<<<<<<<<<<<<
  * 
  *         conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0)
  */
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_zerobased); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (__pyx_t_7) {
-      __pyx_t_1 = PyNumber_Or(__pyx_v_preset, __pyx_int_65536); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_zerobased); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__pyx_t_6) {
+      __pyx_t_1 = PyNumber_Or(__pyx_v_preset, __pyx_int_65536); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_v_preset);
       __pyx_v_preset = __pyx_t_1;
       __pyx_t_1 = 0;
-      goto __pyx_L18;
+      goto __pyx_L19;
     }
-    __pyx_L18:;
+    __pyx_L19:;
 
-    /* "ctabix.pyx":691
+    /* "ctabix.pyx":694
  *         if zerobased: preset = preset | 0x10000
  * 
  *         conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0)             # <<<<<<<<<<<<<<
  * 
  *     cdef ti_conf_t conf
  */
-    __pyx_t_1 = PyNumber_Add(__pyx_v_seq_col, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_Add(__pyx_v_seq_col, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyNumber_Add(__pyx_v_start_col, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Add(__pyx_v_start_col, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = PyNumber_Add(__pyx_v_end_col, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
+    __pyx_t_9 = PyNumber_Add(__pyx_v_end_col, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_14);
     __Pyx_INCREF(__pyx_v_meta_char);
-    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_meta_char);
+    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_meta_char);
     __Pyx_GIVEREF(__pyx_v_meta_char);
-    __pyx_t_13 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-    __pyx_t_12 = PyTuple_New(6); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
+    __pyx_t_15 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_15);
+    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+    __pyx_t_14 = PyTuple_New(6); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_14);
     __Pyx_INCREF(__pyx_v_preset);
-    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_preset);
+    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_preset);
     __Pyx_GIVEREF(__pyx_v_preset);
-    PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1);
+    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_6);
-    __Pyx_GIVEREF(__pyx_t_6);
-    PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_13);
-    __Pyx_GIVEREF(__pyx_t_13);
+    PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_9);
+    __Pyx_GIVEREF(__pyx_t_9);
+    PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_15);
+    __Pyx_GIVEREF(__pyx_t_15);
     __Pyx_INCREF(__pyx_int_0);
-    PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_int_0);
+    PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_int_0);
     __Pyx_GIVEREF(__pyx_int_0);
     __pyx_t_1 = 0;
     __pyx_t_3 = 0;
-    __pyx_t_6 = 0;
-    __pyx_t_13 = 0;
-    __pyx_v_conf_data = ((PyObject *)__pyx_t_12);
-    __pyx_t_12 = 0;
+    __pyx_t_9 = 0;
+    __pyx_t_15 = 0;
+    __pyx_v_conf_data = ((PyObject *)__pyx_t_14);
+    __pyx_t_14 = 0;
   }
-  __pyx_L6:;
+  __pyx_L7:;
 
-  /* "ctabix.pyx":694
+  /* "ctabix.pyx":697
  * 
  *     cdef ti_conf_t conf
  *     conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data             # <<<<<<<<<<<<<<
@@ -7147,103 +7213,103 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
     if (unlikely(size != 6)) {
       if (size > 6) __Pyx_RaiseTooManyValuesError(6);
       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
-      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
-      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
-      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
+      __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
+      __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
+      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 4); 
       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 5); 
     } else {
-      __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
-      __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
-      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
+      __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
+      __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
+      __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
       __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
       __pyx_t_1 = PyList_GET_ITEM(sequence, 4); 
       __pyx_t_2 = PyList_GET_ITEM(sequence, 5); 
     }
-    __Pyx_INCREF(__pyx_t_12);
-    __Pyx_INCREF(__pyx_t_13);
-    __Pyx_INCREF(__pyx_t_6);
+    __Pyx_INCREF(__pyx_t_14);
+    __Pyx_INCREF(__pyx_t_15);
+    __Pyx_INCREF(__pyx_t_9);
     __Pyx_INCREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_t_2);
     #else
     Py_ssize_t i;
-    PyObject** temps[6] = {&__pyx_t_12,&__pyx_t_13,&__pyx_t_6,&__pyx_t_3,&__pyx_t_1,&__pyx_t_2};
+    PyObject** temps[6] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_9,&__pyx_t_3,&__pyx_t_1,&__pyx_t_2};
     for (i=0; i < 6; i++) {
-      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       *(temps[i]) = item;
     }
     #endif
   } else
   {
     Py_ssize_t index = -1;
-    PyObject** temps[6] = {&__pyx_t_12,&__pyx_t_13,&__pyx_t_6,&__pyx_t_3,&__pyx_t_1,&__pyx_t_2};
-    __pyx_t_14 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_14);
-    __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
+    PyObject** temps[6] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_9,&__pyx_t_3,&__pyx_t_1,&__pyx_t_2};
+    __pyx_t_16 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_16);
+    __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
     for (index=0; index < 6; index++) {
-      PyObject* item = __pyx_t_15(__pyx_t_14); if (unlikely(!item)) goto __pyx_L19_unpacking_failed;
+      PyObject* item = __pyx_t_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L20_unpacking_failed;
       __Pyx_GOTREF(item);
       *(temps[index]) = item;
     }
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_15 = NULL;
-    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-    goto __pyx_L20_unpacking_done;
-    __pyx_L19_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-    __pyx_t_15 = NULL;
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = NULL;
+    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+    goto __pyx_L21_unpacking_done;
+    __pyx_L20_unpacking_failed:;
+    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+    __pyx_t_17 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_L20_unpacking_done:;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_L21_unpacking_done:;
   }
-  __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_12); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_17 = __Pyx_PyInt_from_py_int32_t(__pyx_t_13); if (unlikely((__pyx_t_17 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_18 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_18 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_19 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_19 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_18 = __Pyx_PyInt_from_py_int32_t(__pyx_t_14); if (unlikely((__pyx_t_18 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+  __pyx_t_19 = __Pyx_PyInt_from_py_int32_t(__pyx_t_15); if (unlikely((__pyx_t_19 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+  __pyx_t_20 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_20 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_21 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_21 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_20 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_20 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_22 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_22 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_21 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_21 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_23 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_23 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_v_conf.preset = __pyx_t_16;
-  __pyx_v_conf.sc = __pyx_t_17;
-  __pyx_v_conf.bc = __pyx_t_18;
-  __pyx_v_conf.ec = __pyx_t_19;
-  __pyx_v_conf.meta_char = __pyx_t_20;
-  __pyx_v_conf.line_skip = __pyx_t_21;
-
-  /* "ctabix.pyx":696
+  __pyx_v_conf.preset = __pyx_t_18;
+  __pyx_v_conf.sc = __pyx_t_19;
+  __pyx_v_conf.bc = __pyx_t_20;
+  __pyx_v_conf.ec = __pyx_t_21;
+  __pyx_v_conf.meta_char = __pyx_t_22;
+  __pyx_v_conf.line_skip = __pyx_t_23;
+
+  /* "ctabix.pyx":699
  *     conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data
  * 
  *     fn = _my_encodeFilename( filename )             # <<<<<<<<<<<<<<
  *     ti_index_build( fn, &conf)
  * 
  */
-  __pyx_t_2 = ((PyObject *)__pyx_f_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((PyObject *)__pyx_f_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_v_fn = ((PyObject*)__pyx_t_2);
   __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":697
+  /* "ctabix.pyx":700
  * 
  *     fn = _my_encodeFilename( filename )
  *     ti_index_build( fn, &conf)             # <<<<<<<<<<<<<<
  * 
  *     return filename
  */
-  __pyx_t_22 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  ti_index_build(__pyx_t_22, (&__pyx_v_conf));
+  __pyx_t_24 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_24) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  ti_index_build(__pyx_t_24, (&__pyx_v_conf));
 
-  /* "ctabix.pyx":699
+  /* "ctabix.pyx":702
  *     ti_index_build( fn, &conf)
  * 
  *     return filename             # <<<<<<<<<<<<<<
@@ -7261,10 +7327,10 @@ static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_sel
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(__pyx_t_13);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_14);
+  __Pyx_XDECREF(__pyx_t_15);
+  __Pyx_XDECREF(__pyx_t_16);
   __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -7311,7 +7377,7 @@ static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -7323,14 +7389,14 @@ static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_
     }
     __pyx_v_infile = values[0];
     if (values[1]) {
-      __pyx_v_buffer_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_buffer_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_buffer_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_buffer_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_buffer_size = ((int)65536);
     }
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
@@ -7341,7 +7407,7 @@ static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_
   return __pyx_r;
 }
 
-/* "ctabix.pyx":716
+/* "ctabix.pyx":719
  * 
  * 
  *     def __cinit__(self, infile, int buffer_size = 65536 ):             # <<<<<<<<<<<<<<
@@ -7361,17 +7427,17 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ctabix.pyx":718
+  /* "ctabix.pyx":721
  *     def __cinit__(self, infile, int buffer_size = 65536 ):
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )             # <<<<<<<<<<<<<<
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')
  */
-  __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_infile); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_infile); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_fd = __pyx_t_1;
 
-  /* "ctabix.pyx":719
+  /* "ctabix.pyx":722
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -7380,16 +7446,16 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
  */
   __pyx_t_2 = (__pyx_v_fd == -1);
   if (__pyx_t_2) {
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":720
+  /* "ctabix.pyx":723
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')             # <<<<<<<<<<<<<<
@@ -7398,7 +7464,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
  */
   __pyx_v_self->infile = fdopen(__pyx_v_fd, __pyx_k__r);
 
-  /* "ctabix.pyx":722
+  /* "ctabix.pyx":725
  *         self.infile = fdopen( fd, 'r')
  * 
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -7407,16 +7473,16 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
  */
   __pyx_t_2 = (__pyx_v_self->infile == NULL);
   if (__pyx_t_2) {
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
   __pyx_L4:;
 
-  /* "ctabix.pyx":724
+  /* "ctabix.pyx":727
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
  * 
  *         self.buffer = <char*>malloc( buffer_size )             # <<<<<<<<<<<<<<
@@ -7425,7 +7491,7 @@ static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_
  */
   __pyx_v_self->buffer = ((char *)malloc(__pyx_v_buffer_size));
 
-  /* "ctabix.pyx":725
+  /* "ctabix.pyx":728
  * 
  *         self.buffer = <char*>malloc( buffer_size )
  *         self.size = buffer_size             # <<<<<<<<<<<<<<
@@ -7456,7 +7522,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *_
   return __pyx_r;
 }
 
-/* "ctabix.pyx":727
+/* "ctabix.pyx":730
  *         self.size = buffer_size
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -7469,7 +7535,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __py
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":728
+  /* "ctabix.pyx":731
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -7488,7 +7554,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __py
   return __pyx_r;
 }
 
-/* "ctabix.pyx":730
+/* "ctabix.pyx":733
  *         return self
  * 
  *     cdef __cnext__(self):             # <<<<<<<<<<<<<<
@@ -7503,44 +7569,46 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
   char *__pyx_v_result;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  char *__pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   int __pyx_t_4;
   int __pyx_t_5;
   int __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
+  int __pyx_t_7;
   PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cnext__", 0);
 
-  /* "ctabix.pyx":734
+  /* "ctabix.pyx":737
  *         cdef char * b
  *         cdef size_t nbytes
  *         b = self.buffer             # <<<<<<<<<<<<<<
  *         r = self.Parser()
  * 
  */
-  __pyx_v_b = __pyx_v_self->buffer;
+  __pyx_t_1 = __pyx_v_self->buffer;
+  __pyx_v_b = __pyx_t_1;
 
-  /* "ctabix.pyx":735
+  /* "ctabix.pyx":738
  *         cdef size_t nbytes
  *         b = self.buffer
  *         r = self.Parser()             # <<<<<<<<<<<<<<
  * 
  *         while not feof( self.infile ):
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__Parser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__Parser); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_r = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_r = __pyx_t_3;
+  __pyx_t_3 = 0;
 
-  /* "ctabix.pyx":737
+  /* "ctabix.pyx":740
  *         r = self.Parser()
  * 
  *         while not feof( self.infile ):             # <<<<<<<<<<<<<<
@@ -7548,10 +7616,10 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
  * 
  */
   while (1) {
-    __pyx_t_3 = (!feof(__pyx_v_self->infile));
-    if (!__pyx_t_3) break;
+    __pyx_t_4 = (!feof(__pyx_v_self->infile));
+    if (!__pyx_t_4) break;
 
-    /* "ctabix.pyx":738
+    /* "ctabix.pyx":741
  * 
  *         while not feof( self.infile ):
  *             nbytes = getline( &b, &self.size, self.infile)             # <<<<<<<<<<<<<<
@@ -7560,77 +7628,77 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
  */
     __pyx_v_nbytes = getline((&__pyx_v_b), (&__pyx_v_self->size), __pyx_v_self->infile);
 
-    /* "ctabix.pyx":741
+    /* "ctabix.pyx":744
  * 
  *             # stop at first error or eof
  *             if (nbytes == -1): break             # <<<<<<<<<<<<<<
  *             # skip comments
  *             if (b[0] == '#'): continue
  */
-    __pyx_t_3 = (__pyx_v_nbytes == -1);
-    if (__pyx_t_3) {
+    __pyx_t_4 = (__pyx_v_nbytes == -1);
+    if (__pyx_t_4) {
       goto __pyx_L4_break;
       goto __pyx_L5;
     }
     __pyx_L5:;
 
-    /* "ctabix.pyx":743
+    /* "ctabix.pyx":746
  *             if (nbytes == -1): break
  *             # skip comments
  *             if (b[0] == '#'): continue             # <<<<<<<<<<<<<<
  * 
  *             # skip empty lines
  */
-    __pyx_t_3 = ((__pyx_v_b[0]) == '#');
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_b[0]) == '#');
+    if (__pyx_t_4) {
       goto __pyx_L3_continue;
       goto __pyx_L6;
     }
     __pyx_L6:;
 
-    /* "ctabix.pyx":746
+    /* "ctabix.pyx":749
  * 
  *             # skip empty lines
  *             if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue             # <<<<<<<<<<<<<<
  * 
  *             # make sure that entry is complete
  */
-    __pyx_t_3 = ((__pyx_v_b[0]) == '\x00');
-    if (!__pyx_t_3) {
-      __pyx_t_4 = ((__pyx_v_b[0]) == '\n');
-      if (!__pyx_t_4) {
-        __pyx_t_5 = ((__pyx_v_b[0]) == '\r');
-        __pyx_t_6 = __pyx_t_5;
+    __pyx_t_4 = ((__pyx_v_b[0]) == '\x00');
+    if (!__pyx_t_4) {
+      __pyx_t_5 = ((__pyx_v_b[0]) == '\n');
+      if (!__pyx_t_5) {
+        __pyx_t_6 = ((__pyx_v_b[0]) == '\r');
+        __pyx_t_7 = __pyx_t_6;
       } else {
-        __pyx_t_6 = __pyx_t_4;
+        __pyx_t_7 = __pyx_t_5;
       }
-      __pyx_t_4 = __pyx_t_6;
+      __pyx_t_5 = __pyx_t_7;
     } else {
-      __pyx_t_4 = __pyx_t_3;
+      __pyx_t_5 = __pyx_t_4;
     }
-    if (__pyx_t_4) {
+    if (__pyx_t_5) {
       goto __pyx_L3_continue;
       goto __pyx_L7;
     }
     __pyx_L7:;
 
-    /* "ctabix.pyx":749
+    /* "ctabix.pyx":752
  * 
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':             # <<<<<<<<<<<<<<
  *                 result = b
  *                 raise ValueError( "incomplete line at %s" % result )
  */
-    __pyx_t_4 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
-    if (__pyx_t_4) {
-      __pyx_t_3 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
-      __pyx_t_6 = __pyx_t_3;
+    __pyx_t_5 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
+    if (__pyx_t_5) {
+      __pyx_t_4 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
+      __pyx_t_7 = __pyx_t_4;
     } else {
-      __pyx_t_6 = __pyx_t_4;
+      __pyx_t_7 = __pyx_t_5;
     }
-    if (__pyx_t_6) {
+    if (__pyx_t_7) {
 
-      /* "ctabix.pyx":750
+      /* "ctabix.pyx":753
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 result = b             # <<<<<<<<<<<<<<
@@ -7639,61 +7707,61 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
  */
       __pyx_v_result = __pyx_v_b;
 
-      /* "ctabix.pyx":751
+      /* "ctabix.pyx":754
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 result = b
  *                 raise ValueError( "incomplete line at %s" % result )             # <<<<<<<<<<<<<<
  * 
  *             # make sure that this goes fully through C
  */
-      __pyx_t_2 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-      __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "ctabix.pyx":757
+    /* "ctabix.pyx":760
  *             # Python object causing segfaults as
  *             # the wrong memory is freed
  *             r.present( b, nbytes )             # <<<<<<<<<<<<<<
  *             return r
  * 
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__present); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyBytes_FromString(__pyx_v_b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__present); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyBytes_FromString(__pyx_v_b); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
-    __Pyx_GIVEREF(__pyx_t_7);
-    __pyx_t_2 = 0;
-    __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
+    __Pyx_GIVEREF(__pyx_t_8);
+    __pyx_t_3 = 0;
+    __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-    /* "ctabix.pyx":758
+    /* "ctabix.pyx":761
  *             # the wrong memory is freed
  *             r.present( b, nbytes )
  *             return r             # <<<<<<<<<<<<<<
@@ -7708,7 +7776,7 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
   }
   __pyx_L4_break:;
 
-  /* "ctabix.pyx":760
+  /* "ctabix.pyx":763
  *             return r
  * 
  *         raise StopIteration             # <<<<<<<<<<<<<<
@@ -7716,15 +7784,15 @@ static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx
  *     def __dealloc__(self):
  */
   __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
-  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -7743,7 +7811,7 @@ static void __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__p
   __Pyx_RefNannyFinishContext();
 }
 
-/* "ctabix.pyx":762
+/* "ctabix.pyx":765
  *         raise StopIteration
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -7755,7 +7823,7 @@ static void __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
-  /* "ctabix.pyx":763
+  /* "ctabix.pyx":766
  * 
  *     def __dealloc__(self):
  *         free(self.buffer)             # <<<<<<<<<<<<<<
@@ -7778,7 +7846,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *_
   return __pyx_r;
 }
 
-/* "ctabix.pyx":765
+/* "ctabix.pyx":768
  *         free(self.buffer)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -7795,7 +7863,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __py
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":766
+  /* "ctabix.pyx":769
  * 
  *     def __next__(self):
  *         return self.__cnext__()             # <<<<<<<<<<<<<<
@@ -7803,7 +7871,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __py
  * ctypedef class tabix_copy_iterator:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = ((struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -7849,11 +7917,11 @@ static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_s
         case  1:
         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -7866,13 +7934,13 @@ static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_s
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self), __pyx_v_infile, __pyx_v_parser);
   goto __pyx_L0;
   __pyx_L1_error:;
@@ -7882,7 +7950,7 @@ static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_s
   return __pyx_r;
 }
 
-/* "ctabix.pyx":777
+/* "ctabix.pyx":780
  *     '''
  * 
  *     def __cinit__(self, infile, Parser parser ):             # <<<<<<<<<<<<<<
@@ -7902,17 +7970,17 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ctabix.pyx":779
+  /* "ctabix.pyx":782
  *     def __cinit__(self, infile, Parser parser ):
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )             # <<<<<<<<<<<<<<
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')
  */
-  __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_infile); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_infile); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_fd = __pyx_t_1;
 
-  /* "ctabix.pyx":780
+  /* "ctabix.pyx":783
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -7921,16 +7989,16 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
  */
   __pyx_t_2 = (__pyx_v_fd == -1);
   if (__pyx_t_2) {
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":781
+  /* "ctabix.pyx":784
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')             # <<<<<<<<<<<<<<
@@ -7939,7 +8007,7 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
  */
   __pyx_v_self->infile = fdopen(__pyx_v_fd, __pyx_k__r);
 
-  /* "ctabix.pyx":782
+  /* "ctabix.pyx":785
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
@@ -7948,16 +8016,16 @@ static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ct
  */
   __pyx_t_2 = (__pyx_v_self->infile == NULL);
   if (__pyx_t_2) {
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
   __pyx_L4:;
 
-  /* "ctabix.pyx":783
+  /* "ctabix.pyx":786
  *         self.infile = fdopen( fd, 'r')
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
  *         self.parser = parser             # <<<<<<<<<<<<<<
@@ -7992,7 +8060,7 @@ static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__py
   return __pyx_r;
 }
 
-/* "ctabix.pyx":785
+/* "ctabix.pyx":788
  *         self.parser = parser
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -8005,7 +8073,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_o
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":786
+  /* "ctabix.pyx":789
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -8024,7 +8092,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_o
   return __pyx_r;
 }
 
-/* "ctabix.pyx":788
+/* "ctabix.pyx":791
  *         return self
  * 
  *     cdef __cnext__(self):             # <<<<<<<<<<<<<<
@@ -8050,7 +8118,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cnext__", 0);
 
-  /* "ctabix.pyx":794
+  /* "ctabix.pyx":797
  *         cdef int x
  * 
  *         b = NULL             # <<<<<<<<<<<<<<
@@ -8059,7 +8127,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
   __pyx_v_b = NULL;
 
-  /* "ctabix.pyx":796
+  /* "ctabix.pyx":799
  *         b = NULL
  * 
  *         while not feof( self.infile ):             # <<<<<<<<<<<<<<
@@ -8070,7 +8138,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     __pyx_t_1 = (!feof(__pyx_v_self->infile));
     if (!__pyx_t_1) break;
 
-    /* "ctabix.pyx":800
+    /* "ctabix.pyx":803
  *             # getline allocates on demand
  *             # return number of characters read excluding null byte
  *             nbytes = getline( &b, &nbytes, self.infile)             # <<<<<<<<<<<<<<
@@ -8079,7 +8147,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
     __pyx_v_nbytes = getline((&__pyx_v_b), (&__pyx_v_nbytes), __pyx_v_self->infile);
 
-    /* "ctabix.pyx":802
+    /* "ctabix.pyx":805
  *             nbytes = getline( &b, &nbytes, self.infile)
  *             # stop at first error
  *             if (nbytes == -1): break             # <<<<<<<<<<<<<<
@@ -8093,7 +8161,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     __pyx_L5:;
 
-    /* "ctabix.pyx":804
+    /* "ctabix.pyx":807
  *             if (nbytes == -1): break
  *             # skip comments
  *             if (b[0] == '#'): continue             # <<<<<<<<<<<<<<
@@ -8107,7 +8175,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     __pyx_L6:;
 
-    /* "ctabix.pyx":807
+    /* "ctabix.pyx":810
  * 
  *             # skip empty lines
  *             if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue             # <<<<<<<<<<<<<<
@@ -8133,7 +8201,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     __pyx_L7:;
 
-    /* "ctabix.pyx":810
+    /* "ctabix.pyx":813
  * 
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':             # <<<<<<<<<<<<<<
@@ -8149,7 +8217,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     }
     if (__pyx_t_4) {
 
-      /* "ctabix.pyx":811
+      /* "ctabix.pyx":814
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 result = b             # <<<<<<<<<<<<<<
@@ -8158,7 +8226,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
       __pyx_v_result = __pyx_v_b;
 
-      /* "ctabix.pyx":812
+      /* "ctabix.pyx":815
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 result = b
  *                 free(b)             # <<<<<<<<<<<<<<
@@ -8167,34 +8235,34 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
       free(__pyx_v_b);
 
-      /* "ctabix.pyx":813
+      /* "ctabix.pyx":816
  *                 result = b
  *                 free(b)
  *                 raise ValueError( "incomplete line at %s" % result )             # <<<<<<<<<<<<<<
  * 
  *             # make sure that this goes fully through C
  */
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_6));
       __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
       __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "ctabix.pyx":820
+    /* "ctabix.pyx":823
  *             # the wrong memory is freed
  *             # -1 to remove the new-line character
  *             return self.parser(b, nbytes)             # <<<<<<<<<<<<<<
@@ -8202,11 +8270,11 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  *         free(b)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_6 = PyBytes_FromString(__pyx_v_b); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyBytes_FromString(__pyx_v_b); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
@@ -8214,7 +8282,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
     __Pyx_GIVEREF(__pyx_t_5);
     __pyx_t_6 = 0;
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(((PyObject *)__pyx_v_self->parser), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(((PyObject *)__pyx_v_self->parser), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
     __pyx_r = __pyx_t_5;
@@ -8224,7 +8292,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
   }
   __pyx_L4_break:;
 
-  /* "ctabix.pyx":822
+  /* "ctabix.pyx":825
  *             return self.parser(b, nbytes)
  * 
  *         free(b)             # <<<<<<<<<<<<<<
@@ -8233,7 +8301,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  */
   free(__pyx_v_b);
 
-  /* "ctabix.pyx":823
+  /* "ctabix.pyx":826
  * 
  *         free(b)
  *         raise StopIteration             # <<<<<<<<<<<<<<
@@ -8241,7 +8309,7 @@ static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_ob
  *     def __next__(self):
  */
   __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
-  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -8268,7 +8336,7 @@ static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__py
   return __pyx_r;
 }
 
-/* "ctabix.pyx":825
+/* "ctabix.pyx":828
  *         raise StopIteration
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -8285,7 +8353,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_o
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":826
+  /* "ctabix.pyx":829
  * 
  *     def __next__(self):
  *         return self.__cnext__()             # <<<<<<<<<<<<<<
@@ -8293,7 +8361,7 @@ static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_o
  * class tabix_generic_iterator:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = ((struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -8343,16 +8411,16 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *_
         case  1:
         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
       goto __pyx_L5_argtuple_error;
@@ -8367,7 +8435,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *_
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
@@ -8378,7 +8446,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *_
   return __pyx_r;
 }
 
-/* "ctabix.pyx":833
+/* "ctabix.pyx":836
  *     Permits the use of file-like objects for example from the gzip module.
  *     '''
  *     def __init__(self, infile, parser ):             # <<<<<<<<<<<<<<
@@ -8397,47 +8465,47 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSE
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__init__", 0);
 
-  /* "ctabix.pyx":835
+  /* "ctabix.pyx":838
  *     def __init__(self, infile, parser ):
  * 
  *         self.infile = infile             # <<<<<<<<<<<<<<
  *         if self.infile.closed: raise ValueError( "I/O operation on closed file." )
  *         self.parser = parser
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__infile, __pyx_v_infile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__infile, __pyx_v_infile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":836
+  /* "ctabix.pyx":839
  * 
  *         self.infile = infile
  *         if self.infile.closed: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
  *         self.parser = parser
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__infile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__infile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__closed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__closed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "ctabix.pyx":837
+  /* "ctabix.pyx":840
  *         self.infile = infile
  *         if self.infile.closed: raise ValueError( "I/O operation on closed file." )
  *         self.parser = parser             # <<<<<<<<<<<<<<
  * 
  *     def __iter__(self):
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__parser, __pyx_v_parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__parser, __pyx_v_parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -8465,7 +8533,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *_
   return __pyx_r;
 }
 
-/* "ctabix.pyx":839
+/* "ctabix.pyx":842
  *         self.parser = parser
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -8478,7 +8546,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUS
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "ctabix.pyx":840
+  /* "ctabix.pyx":843
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -8510,7 +8578,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__(PyObject *_
   return __pyx_r;
 }
 
-/* "ctabix.pyx":843
+/* "ctabix.pyx":846
  * 
  *     # cython version - required for python 3
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -8541,7 +8609,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__next__", 0);
 
-  /* "ctabix.pyx":847
+  /* "ctabix.pyx":850
  *         cdef char * b, * cpy
  *         cdef size_t nbytes
  *         while 1:             # <<<<<<<<<<<<<<
@@ -8551,33 +8619,33 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
   while (1) {
     if (!1) break;
 
-    /* "ctabix.pyx":849
+    /* "ctabix.pyx":852
  *         while 1:
  * 
  *             line = self.infile.readline()             # <<<<<<<<<<<<<<
  *             if not line: break
  * 
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__infile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__infile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__readline); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__readline); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_XDECREF(__pyx_v_line);
     __pyx_v_line = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "ctabix.pyx":850
+    /* "ctabix.pyx":853
  * 
  *             line = self.infile.readline()
  *             if not line: break             # <<<<<<<<<<<<<<
  * 
  *             s = _force_bytes( line )
  */
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = (!__pyx_t_3);
     if (__pyx_t_4) {
       goto __pyx_L4_break;
@@ -8585,40 +8653,40 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     __pyx_L5:;
 
-    /* "ctabix.pyx":852
+    /* "ctabix.pyx":855
  *             if not line: break
  * 
  *             s = _force_bytes( line )             # <<<<<<<<<<<<<<
  *             b = s
  *             nbytes = len( line )
  */
-    __pyx_t_1 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_line)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_line)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_XDECREF(((PyObject *)__pyx_v_s));
     __pyx_v_s = ((PyObject*)__pyx_t_1);
     __pyx_t_1 = 0;
 
-    /* "ctabix.pyx":853
+    /* "ctabix.pyx":856
  * 
  *             s = _force_bytes( line )
  *             b = s             # <<<<<<<<<<<<<<
  *             nbytes = len( line )
  *             assert b[nbytes] == '\0'
  */
-    __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_s)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_s)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_v_b = __pyx_t_5;
 
-    /* "ctabix.pyx":854
+    /* "ctabix.pyx":857
  *             s = _force_bytes( line )
  *             b = s
  *             nbytes = len( line )             # <<<<<<<<<<<<<<
  *             assert b[nbytes] == '\0'
  * 
  */
-    __pyx_t_6 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_v_nbytes = __pyx_t_6;
 
-    /* "ctabix.pyx":855
+    /* "ctabix.pyx":858
  *             b = s
  *             nbytes = len( line )
  *             assert b[nbytes] == '\0'             # <<<<<<<<<<<<<<
@@ -8628,11 +8696,11 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     #ifndef CYTHON_WITHOUT_ASSERTIONS
     if (unlikely(!((__pyx_v_b[__pyx_v_nbytes]) == '\x00'))) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "ctabix.pyx":858
+    /* "ctabix.pyx":861
  * 
  *             # skip comments
  *             if (b[0] == '#'): continue             # <<<<<<<<<<<<<<
@@ -8646,7 +8714,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     __pyx_L6:;
 
-    /* "ctabix.pyx":861
+    /* "ctabix.pyx":864
  * 
  *             # skip empty lines
  *             if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue             # <<<<<<<<<<<<<<
@@ -8672,7 +8740,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     __pyx_L7:;
 
-    /* "ctabix.pyx":864
+    /* "ctabix.pyx":867
  * 
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':             # <<<<<<<<<<<<<<
@@ -8688,31 +8756,31 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     }
     if (__pyx_t_8) {
 
-      /* "ctabix.pyx":865
+      /* "ctabix.pyx":868
  *             # make sure that entry is complete
  *             if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
  *                 raise ValueError( "incomplete line at %s" % line )             # <<<<<<<<<<<<<<
  * 
  *             # create a copy
  */
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), __pyx_v_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), __pyx_v_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
 
-    /* "ctabix.pyx":868
+    /* "ctabix.pyx":871
  * 
  *             # create a copy
  *             cpy = <char*>malloc(nbytes+1)             # <<<<<<<<<<<<<<
@@ -8721,7 +8789,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
  */
     __pyx_v_cpy = ((char *)malloc((__pyx_v_nbytes + 1)));
 
-    /* "ctabix.pyx":869
+    /* "ctabix.pyx":872
  *             # create a copy
  *             cpy = <char*>malloc(nbytes+1)
  *             if cpy == NULL: raise MemoryError()             # <<<<<<<<<<<<<<
@@ -8730,12 +8798,12 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
  */
     __pyx_t_8 = (__pyx_v_cpy == NULL);
     if (__pyx_t_8) {
-      PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
     __pyx_L9:;
 
-    /* "ctabix.pyx":870
+    /* "ctabix.pyx":873
  *             cpy = <char*>malloc(nbytes+1)
  *             if cpy == NULL: raise MemoryError()
  *             memcpy( cpy, b, nbytes+1)             # <<<<<<<<<<<<<<
@@ -8744,7 +8812,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
  */
     memcpy(__pyx_v_cpy, __pyx_v_b, (__pyx_v_nbytes + 1));
 
-    /* "ctabix.pyx":872
+    /* "ctabix.pyx":875
  *             memcpy( cpy, b, nbytes+1)
  * 
  *             return self.parser(cpy, nbytes)             # <<<<<<<<<<<<<<
@@ -8752,13 +8820,13 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
  *         raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyBytes_FromString(__pyx_v_cpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromString(__pyx_v_cpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
     PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_2));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
@@ -8766,7 +8834,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
     __Pyx_GIVEREF(__pyx_t_9);
     __pyx_t_2 = 0;
     __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
@@ -8777,7 +8845,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
   }
   __pyx_L4_break:;
 
-  /* "ctabix.pyx":874
+  /* "ctabix.pyx":877
  *             return self.parser(cpy, nbytes)
  * 
  *         raise StopIteration             # <<<<<<<<<<<<<<
@@ -8785,7 +8853,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUS
  *     # python version - required for python 2.7
  */
   __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
-  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -8817,7 +8885,7 @@ static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx
   return __pyx_r;
 }
 
-/* "ctabix.pyx":877
+/* "ctabix.pyx":880
  * 
  *     # python version - required for python 2.7
  *     def next(self):             # <<<<<<<<<<<<<<
@@ -8835,7 +8903,7 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED P
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("next", 0);
 
-  /* "ctabix.pyx":878
+  /* "ctabix.pyx":881
  *     # python version - required for python 2.7
  *     def next(self):
  *         return self.__next__()             # <<<<<<<<<<<<<<
@@ -8843,9 +8911,9 @@ static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED P
  * def tabix_iterator( infile, parser ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____next__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____next__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -8895,11 +8963,11 @@ static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject
         case  1:
         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tabix_iterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tabix_iterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
       goto __pyx_L5_argtuple_error;
@@ -8912,7 +8980,7 @@ static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
@@ -8923,7 +8991,7 @@ static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "ctabix.pyx":880
+/* "ctabix.pyx":883
  *         return self.__next__()
  * 
  * def tabix_iterator( infile, parser ):             # <<<<<<<<<<<<<<
@@ -8942,7 +9010,7 @@ static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("tabix_iterator", 0);
 
-  /* "ctabix.pyx":882
+  /* "ctabix.pyx":885
  * def tabix_iterator( infile, parser ):
  *     """return an iterator over all entries in a file."""
  *     return tabix_generic_iterator( infile, parser )             # <<<<<<<<<<<<<<
@@ -8950,9 +9018,9 @@ static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_
  *     # used to be: isinstance( infile, file):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_56); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_58); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_INCREF(__pyx_v_infile);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_infile);
@@ -8960,7 +9028,7 @@ static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_INCREF(__pyx_v_parser);
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_parser);
   __Pyx_GIVEREF(__pyx_v_parser);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
@@ -9026,9 +9094,9 @@ static PyMethodDef __pyx_methods_6ctabix_Tabixfile[] = {
 };
 
 static struct PyGetSetDef __pyx_getsets_6ctabix_Tabixfile[] = {
-  {(char *)"filename", __pyx_getprop_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_57), 0},
-  {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_58), 0},
-  {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_59), 0},
+  {(char *)"filename", __pyx_getprop_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_59), 0},
+  {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_60), 0},
+  {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_61), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -10386,6 +10454,7 @@ static PyObject *__pyx_tp_new_6ctabix_TabixIteratorParsed(PyTypeObject *t, PyObj
 
 static void __pyx_tp_dealloc_6ctabix_TabixIteratorParsed(PyObject *o) {
   struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -10396,6 +10465,7 @@ static void __pyx_tp_dealloc_6ctabix_TabixIteratorParsed(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->parser);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -10592,6 +10662,7 @@ static PyObject *__pyx_tp_new_6ctabix_tabix_inplace_iterator(PyTypeObject *t, Py
 
 static void __pyx_tp_dealloc_6ctabix_tabix_inplace_iterator(PyObject *o) {
   struct __pyx_obj_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -10602,6 +10673,7 @@ static void __pyx_tp_dealloc_6ctabix_tabix_inplace_iterator(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->parser);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -10798,7 +10870,9 @@ static PyObject *__pyx_tp_new_6ctabix_tabix_copy_iterator(PyTypeObject *t, PyObj
 
 static void __pyx_tp_dealloc_6ctabix_tabix_copy_iterator(PyObject *o) {
   struct __pyx_obj_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_6ctabix_tabix_copy_iterator *)o;
+  PyObject_GC_UnTrack(o);
   Py_CLEAR(p->parser);
+  PyObject_GC_Track(o);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -11021,17 +11095,18 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
   {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
   {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
-  {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
   {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
   {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
-  {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
-  {&__pyx_n_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 1},
+  {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
+  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
+  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
+  {&__pyx_n_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 1},
   {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
-  {&__pyx_n_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 1},
-  {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0},
+  {&__pyx_n_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 1},
+  {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
   {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
-  {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0},
-  {&__pyx_n_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 1},
+  {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0},
+  {&__pyx_n_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 1},
   {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
   {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
   {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
@@ -11140,9 +11215,9 @@ static int __Pyx_InitCachedBuiltins(void) {
   __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -11354,103 +11429,117 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
 
-  /* "ctabix.pyx":655
- *     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
+  /* "ctabix.pyx":656
  * 
- *     if not filename.endswith(".gz"):             # <<<<<<<<<<<<<<
- *         tabix_compress( filename, filename + ".gz", force = force )
- *         os.unlink( filename )
+ *     if preset == None and (seq_col == None or start_col == None or end_col == None):
+ *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )             # <<<<<<<<<<<<<<
+ * 
+ *     if not filename.endswith(".gz"):
  */
-  __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_44);
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
   PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_43));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
 
-  /* "ctabix.pyx":661
+  /* "ctabix.pyx":658
+ *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )
  * 
- *     if not force and os.path.exists(filename + ".tbi" ):
- *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )             # <<<<<<<<<<<<<<
- * 
- *     # columns (1-based)
+ *     if not filename.endswith(".gz"):             # <<<<<<<<<<<<<<
+ *         tabix_compress( filename, filename + ".gz", force = force )
+ *         os.unlink( filename )
  */
-  __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_46);
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
   PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_45));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
 
-  /* "ctabix.pyx":719
+  /* "ctabix.pyx":664
+ * 
+ *     if not force and os.path.exists(filename + ".tbi" ):
+ *         raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )             # <<<<<<<<<<<<<<
+ * 
+ *     # columns (1-based)
+ */
+  __pyx_k_tuple_48 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_48);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_47));
+  PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, ((PyObject *)__pyx_kp_s_47));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_47));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));
+
+  /* "ctabix.pyx":722
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
  *         self.infile = fdopen( fd, 'r')
  * 
  */
-  __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_50);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
+  __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_52);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
+  PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
 
-  /* "ctabix.pyx":722
+  /* "ctabix.pyx":725
  *         self.infile = fdopen( fd, 'r')
  * 
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
  * 
  *         self.buffer = <char*>malloc( buffer_size )
  */
-  __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_51);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
+  __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_53);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
+  PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
 
-  /* "ctabix.pyx":780
+  /* "ctabix.pyx":783
  * 
  *         cdef int fd = PyObject_AsFileDescriptor( infile )
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
  *         self.infile = fdopen( fd, 'r')
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
  */
-  __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_53);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
+  __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_55);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
+  PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
 
-  /* "ctabix.pyx":782
+  /* "ctabix.pyx":785
  *         if fd == -1: raise ValueError( "I/O operation on closed file." )
  *         self.infile = fdopen( fd, 'r')
  *         if self.infile == NULL: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
  *         self.parser = parser
  * 
  */
-  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_54);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
-  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
+  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_56);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
+  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
 
-  /* "ctabix.pyx":836
+  /* "ctabix.pyx":839
  * 
  *         self.infile = infile
  *         if self.infile.closed: raise ValueError( "I/O operation on closed file." )             # <<<<<<<<<<<<<<
  *         self.parser = parser
  * 
  */
-  __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_55);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
-  PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
+  __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_57);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
+  PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
 
   /* "ctabix.pyx":564
  *             ti_iter_destroy(self.iterator)
@@ -11459,43 +11548,43 @@ static int __Pyx_InitCachedConstants(void) {
  *                     filename_out,
  *                     force = False ):
  */
-  __pyx_k_tuple_61 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_61);
+  __pyx_k_tuple_63 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_63);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filename_in));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_n_s__filename_in));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_n_s__filename_in));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename_in));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filename_out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 1, ((PyObject *)__pyx_n_s__filename_out));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 1, ((PyObject *)__pyx_n_s__filename_out));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename_out));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__force));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 2, ((PyObject *)__pyx_n_s__force));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 2, ((PyObject *)__pyx_n_s__force));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__force));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__WINDOW_SIZE));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 3, ((PyObject *)__pyx_n_s__WINDOW_SIZE));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 3, ((PyObject *)__pyx_n_s__WINDOW_SIZE));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__WINDOW_SIZE));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__c));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 4, ((PyObject *)__pyx_n_s__c));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 4, ((PyObject *)__pyx_n_s__c));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 5, ((PyObject *)__pyx_n_s__r));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 5, ((PyObject *)__pyx_n_s__r));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__buffer));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 6, ((PyObject *)__pyx_n_s__buffer));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 6, ((PyObject *)__pyx_n_s__buffer));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buffer));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fp));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 7, ((PyObject *)__pyx_n_s__fp));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 7, ((PyObject *)__pyx_n_s__fp));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fp));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fd_src));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 8, ((PyObject *)__pyx_n_s__fd_src));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 8, ((PyObject *)__pyx_n_s__fd_src));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd_src));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__O_RDONLY));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 9, ((PyObject *)__pyx_n_s__O_RDONLY));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 9, ((PyObject *)__pyx_n_s__O_RDONLY));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__O_RDONLY));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fn));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 10, ((PyObject *)__pyx_n_s__fn));
+  PyTuple_SET_ITEM(__pyx_k_tuple_63, 10, ((PyObject *)__pyx_n_s__fn));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fn));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
-  __pyx_k_codeobj_62 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__tabix_compress, 564, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
+  __pyx_k_codeobj_64 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__tabix_compress, 564, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "ctabix.pyx":611
  *     if r < 0: raise OSError("writing failed")
@@ -11504,145 +11593,145 @@ static int __Pyx_InitCachedConstants(void) {
  *                  force = False,
  *                  seq_col = None,
  */
-  __pyx_k_tuple_64 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_64);
+  __pyx_k_tuple_66 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_66);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__filename));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, ((PyObject *)__pyx_n_s__filename));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_n_s__filename));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__force));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 1, ((PyObject *)__pyx_n_s__force));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 1, ((PyObject *)__pyx_n_s__force));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__force));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__seq_col));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 2, ((PyObject *)__pyx_n_s__seq_col));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 2, ((PyObject *)__pyx_n_s__seq_col));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__seq_col));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__start_col));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 3, ((PyObject *)__pyx_n_s__start_col));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 3, ((PyObject *)__pyx_n_s__start_col));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start_col));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__end_col));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 4, ((PyObject *)__pyx_n_s__end_col));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 4, ((PyObject *)__pyx_n_s__end_col));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end_col));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__preset));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 5, ((PyObject *)__pyx_n_s__preset));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 5, ((PyObject *)__pyx_n_s__preset));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__preset));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__meta_char));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 6, ((PyObject *)__pyx_n_s__meta_char));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 6, ((PyObject *)__pyx_n_s__meta_char));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__meta_char));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__zerobased));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 7, ((PyObject *)__pyx_n_s__zerobased));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 7, ((PyObject *)__pyx_n_s__zerobased));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zerobased));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__preset2conf));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 8, ((PyObject *)__pyx_n_s__preset2conf));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 8, ((PyObject *)__pyx_n_s__preset2conf));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__preset2conf));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__conf_data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 9, ((PyObject *)__pyx_n_s__conf_data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 9, ((PyObject *)__pyx_n_s__conf_data));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__conf_data));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__conf));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 10, ((PyObject *)__pyx_n_s__conf));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 10, ((PyObject *)__pyx_n_s__conf));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__conf));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fn));
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 11, ((PyObject *)__pyx_n_s__fn));
+  PyTuple_SET_ITEM(__pyx_k_tuple_66, 11, ((PyObject *)__pyx_n_s__fn));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fn));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
-  __pyx_k_codeobj_65 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__tabix_index, 611, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
+  __pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__tabix_index, 611, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":833
+  /* "ctabix.pyx":836
  *     Permits the use of file-like objects for example from the gzip module.
  *     '''
  *     def __init__(self, infile, parser ):             # <<<<<<<<<<<<<<
  * 
  *         self.infile = infile
  */
-  __pyx_k_tuple_66 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_66);
+  __pyx_k_tuple_68 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_68);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__infile));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 1, ((PyObject *)__pyx_n_s__infile));
+  PyTuple_SET_ITEM(__pyx_k_tuple_68, 1, ((PyObject *)__pyx_n_s__infile));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__infile));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__parser));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 2, ((PyObject *)__pyx_n_s__parser));
+  PyTuple_SET_ITEM(__pyx_k_tuple_68, 2, ((PyObject *)__pyx_n_s__parser));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parser));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
-  __pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s____init__, 833, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
+  __pyx_k_codeobj_69 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____init__, 836, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":839
+  /* "ctabix.pyx":842
  *         self.parser = parser
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         return self
  * 
  */
-  __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_68);
+  __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_70);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
-  __pyx_k_codeobj_69 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s____iter__, 839, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
+  __pyx_k_codeobj_71 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____iter__, 842, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":843
+  /* "ctabix.pyx":846
  * 
  *     # cython version - required for python 3
  *     def __next__(self):             # <<<<<<<<<<<<<<
  * 
  *         cdef char * b, * cpy
  */
-  __pyx_k_tuple_70 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_70);
+  __pyx_k_tuple_72 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_72);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
-  PyTuple_SET_ITEM(__pyx_k_tuple_70, 1, ((PyObject *)__pyx_n_s__b));
+  PyTuple_SET_ITEM(__pyx_k_tuple_72, 1, ((PyObject *)__pyx_n_s__b));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__cpy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_70, 2, ((PyObject *)__pyx_n_s__cpy));
+  PyTuple_SET_ITEM(__pyx_k_tuple_72, 2, ((PyObject *)__pyx_n_s__cpy));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpy));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__nbytes));
-  PyTuple_SET_ITEM(__pyx_k_tuple_70, 3, ((PyObject *)__pyx_n_s__nbytes));
+  PyTuple_SET_ITEM(__pyx_k_tuple_72, 3, ((PyObject *)__pyx_n_s__nbytes));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nbytes));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
-  PyTuple_SET_ITEM(__pyx_k_tuple_70, 4, ((PyObject *)__pyx_n_s__line));
+  PyTuple_SET_ITEM(__pyx_k_tuple_72, 4, ((PyObject *)__pyx_n_s__line));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
-  PyTuple_SET_ITEM(__pyx_k_tuple_70, 5, ((PyObject *)__pyx_n_s__s));
+  PyTuple_SET_ITEM(__pyx_k_tuple_72, 5, ((PyObject *)__pyx_n_s__s));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
-  __pyx_k_codeobj_71 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s____next__, 843, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
+  __pyx_k_codeobj_73 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s____next__, 846, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":877
+  /* "ctabix.pyx":880
  * 
  *     # python version - required for python 2.7
  *     def next(self):             # <<<<<<<<<<<<<<
  *         return self.__next__()
  * 
  */
-  __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_72);
+  __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_74);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
-  __pyx_k_codeobj_73 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__next, 877, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74));
+  __pyx_k_codeobj_75 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__next, 880, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "ctabix.pyx":880
+  /* "ctabix.pyx":883
  *         return self.__next__()
  * 
  * def tabix_iterator( infile, parser ):             # <<<<<<<<<<<<<<
  *     """return an iterator over all entries in a file."""
  *     return tabix_generic_iterator( infile, parser )
  */
-  __pyx_k_tuple_75 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_75);
+  __pyx_k_tuple_77 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_77);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__infile));
-  PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_n_s__infile));
+  PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_n_s__infile));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__infile));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__parser));
-  PyTuple_SET_ITEM(__pyx_k_tuple_75, 1, ((PyObject *)__pyx_n_s__parser));
+  PyTuple_SET_ITEM(__pyx_k_tuple_77, 1, ((PyObject *)__pyx_n_s__parser));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parser));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
-  __pyx_k_codeobj_76 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__tabix_iterator, 880, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
+  __pyx_k_codeobj_78 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__tabix_iterator, 883, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -11717,6 +11806,14 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "ctabix")) {
+      if (unlikely(PyDict_SetItemString(modules, "ctabix", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -11799,15 +11896,15 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __pyx_ptype_6ctabix_TabixIteratorParsed = &__pyx_type_6ctabix_TabixIteratorParsed;
   __pyx_vtabptr_6ctabix_tabix_inplace_iterator = &__pyx_vtable_6ctabix_tabix_inplace_iterator;
   __pyx_vtable_6ctabix_tabix_inplace_iterator.__pyx___cnext__ = (PyObject *(*)(struct __pyx_obj_6ctabix_tabix_inplace_iterator *))__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__;
-  if (PyType_Ready(&__pyx_type_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_6ctabix_tabix_inplace_iterator.tp_dict, __pyx_vtabptr_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "tabix_inplace_iterator", (PyObject *)&__pyx_type_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_6ctabix_tabix_inplace_iterator.tp_dict, __pyx_vtabptr_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "tabix_inplace_iterator", (PyObject *)&__pyx_type_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_6ctabix_tabix_inplace_iterator = &__pyx_type_6ctabix_tabix_inplace_iterator;
   __pyx_vtabptr_6ctabix_tabix_copy_iterator = &__pyx_vtable_6ctabix_tabix_copy_iterator;
   __pyx_vtable_6ctabix_tabix_copy_iterator.__pyx___cnext__ = (PyObject *(*)(struct __pyx_obj_6ctabix_tabix_copy_iterator *))__pyx_f_6ctabix_19tabix_copy_iterator___cnext__;
-  if (PyType_Ready(&__pyx_type_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_6ctabix_tabix_copy_iterator.tp_dict, __pyx_vtabptr_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "tabix_copy_iterator", (PyObject *)&__pyx_type_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_6ctabix_tabix_copy_iterator.tp_dict, __pyx_vtabptr_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "tabix_copy_iterator", (PyObject *)&__pyx_type_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_6ctabix_tabix_copy_iterator = &__pyx_type_6ctabix_tabix_copy_iterator;
   /*--- Type import code ---*/
   __pyx_ptype_10TabProxies_TupleProxy = __Pyx_ImportType("TabProxies", "TupleProxy", sizeof(struct __pyx_obj_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -11906,7 +12003,7 @@ PyMODINIT_FUNC PyInit_ctabix(void)
  */
   __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_60); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_62); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -12043,98 +12140,98 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_index, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":828
+  /* "ctabix.pyx":831
  *         return self.__cnext__()
  * 
  * class tabix_generic_iterator:             # <<<<<<<<<<<<<<
  *     '''iterate over ``infile``.
  * 
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
-  /* "ctabix.pyx":833
+  /* "ctabix.pyx":836
  *     Permits the use of file-like objects for example from the gzip module.
  *     '''
  *     def __init__(self, infile, parser ):             # <<<<<<<<<<<<<<
  * 
  *         self.infile = infile
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_1__init__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_67)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_1__init__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_69)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":839
+  /* "ctabix.pyx":842
  *         self.parser = parser
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         return self
  * 
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_3__iter__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_69)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_3__iter__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_71)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____iter__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____iter__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":843
+  /* "ctabix.pyx":846
  * 
  *     # cython version - required for python 3
  *     def __next__(self):             # <<<<<<<<<<<<<<
  * 
  *         cdef char * b, * cpy
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_5__next__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_71)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_5__next__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_73)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____next__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____next__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":877
+  /* "ctabix.pyx":880
  * 
  *     # python version - required for python 2.7
  *     def next(self):             # <<<<<<<<<<<<<<
  *         return self.__next__()
  * 
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_7next, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_73)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_7next, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_75)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__next, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__next, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ctabix.pyx":828
+  /* "ctabix.pyx":831
  *         return self.__cnext__()
  * 
  * class tabix_generic_iterator:             # <<<<<<<<<<<<<<
  *     '''iterate over ``infile``.
  * 
  */
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_74)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s_56, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_76)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s_58, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_56, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_58, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":880
+  /* "ctabix.pyx":883
  *         return self.__next__()
  * 
  * def tabix_iterator( infile, parser ):             # <<<<<<<<<<<<<<
  *     """return an iterator over all entries in a file."""
  *     return tabix_generic_iterator( infile, parser )
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_5tabix_iterator, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_5tabix_iterator, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_iterator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_iterator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "ctabix.pyx":896
+  /* "ctabix.pyx":899
  * #            return tabix_generic_iterator( infile, parser )
  * 
  * __all__ = ["tabix_index",             # <<<<<<<<<<<<<<
  *            "tabix_compress",
  *            "Tabixfile",
  */
-  __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_index));
   PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tabix_index));
@@ -12160,10 +12257,10 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_iterator));
   PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__tabix_iterator));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_iterator));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s_77));
-  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s_77));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_77));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_INCREF(((PyObject *)__pyx_n_s_79));
+  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s_79));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_79));
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "ctabix.pyx":1
@@ -13285,6 +13382,10 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
         else
             return (int32_t)__Pyx_PyInt_AsSignedLongLong(x);
     }  else {
+        #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+        PyErr_SetString(PyExc_RuntimeError,
+                        "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+        #else
         int32_t val;
         PyObject *v = __Pyx_PyNumber_Int(x);
         #if PY_VERSION_HEX < 0x03000000
@@ -13304,6 +13405,7 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
             if (likely(!ret))
                 return val;
         }
+        #endif
         return (int32_t)-1;
     }
 }
diff --git a/pysam/ctabix.pyx b/pysam/ctabix.pyx
index a522676..6a19541 100644
--- a/pysam/ctabix.pyx
+++ b/pysam/ctabix.pyx
@@ -652,6 +652,9 @@ def tabix_index( filename,
     
     if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
 
+    if preset == None and (seq_col == None or start_col == None or end_col == None):
+        raise ValueError("neither preset nor seq_col,start_col and end_col given" )
+
     if not filename.endswith(".gz"): 
         tabix_compress( filename, filename + ".gz", force = force )
         os.unlink( filename )
diff --git a/pysam/cvcf.c b/pysam/cvcf.c
index 6caaba0..6243139 100644
--- a/pysam/cvcf.c
+++ b/pysam/cvcf.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.16 on Mon Nov 19 08:44:41 2012 */
+/* Generated by Cython 0.16 on Tue Nov  6 12:17:11 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -461,8 +461,8 @@ struct __pyx_obj_10TabProxies_TupleProxy {
 };
 
 
-/* "TabProxies.pxd":69
- *     cdef char * getAttributes( self )
+/* "TabProxies.pxd":68
+ *     cdef int getMaxFields( self, size_t nbytes )
  * 
  * cdef class NamedTupleProxy( TupleProxy) :             # <<<<<<<<<<<<<<
  *     pass
@@ -473,7 +473,7 @@ struct __pyx_obj_10TabProxies_NamedTupleProxy {
 };
 
 
-/* "TabProxies.pxd":72
+/* "TabProxies.pxd":71
  *     pass
  * 
  * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -519,7 +519,7 @@ struct __pyx_obj_4cvcf_VCFRecord {
 };
 
 
-/* "TabProxies.pxd":83
+/* "TabProxies.pxd":82
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -753,8 +753,8 @@ struct __pyx_vtabstruct_10TabProxies_TupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy;
 
 
-/* "TabProxies.pxd":69
- *     cdef char * getAttributes( self )
+/* "TabProxies.pxd":68
+ *     cdef int getMaxFields( self, size_t nbytes )
  * 
  * cdef class NamedTupleProxy( TupleProxy) :             # <<<<<<<<<<<<<<
  *     pass
@@ -767,7 +767,7 @@ struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
 static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
 
 
-/* "TabProxies.pxd":83
+/* "TabProxies.pxd":82
  *     cdef update( self, char * buffer, size_t nbytes )
  * 
  * cdef class VCFProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -805,7 +805,6 @@ static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_6ct
 
 struct __pyx_vtabstruct_10TabProxies_GTFProxy {
   struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
-  char *(*getAttributes)(struct __pyx_obj_10TabProxies_GTFProxy *);
 };
 static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy;
 
@@ -824,7 +823,7 @@ struct __pyx_vtabstruct_4cvcf_VCFRecord {
 static struct __pyx_vtabstruct_4cvcf_VCFRecord *__pyx_vtabptr_4cvcf_VCFRecord;
 
 
-/* "TabProxies.pxd":72
+/* "TabProxies.pxd":71
  *     pass
  * 
  * cdef class BedProxy( NamedTupleProxy) :             # <<<<<<<<<<<<<<
@@ -1468,7 +1467,7 @@ static char __pyx_k_125[] = "Invalid error string: %s";
 static char __pyx_k_126[] = "needs to be checked";
 static char __pyx_k_128[] = "[|/\\\\]";
 static char __pyx_k_130[] = "^[ACGTN]+$";
-static char __pyx_k_134[] = "/ifs/devel/pysam/pysam/cvcf.pyx";
+static char __pyx_k_134[] = "/home/andreas/devel/pysam/pysam/cvcf.pyx";
 static char __pyx_k_137[] = "id numbertype number type description missingvalue";
 static char __pyx_k_139[] = "UNKNOWN_FORMAT_STRING:Unknown file format identifier";
 static char __pyx_k_140[] = "BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string";
@@ -26499,12 +26498,12 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   __pyx_vtabptr_6ctabix_tabix_copy_iterator = (struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator*)__Pyx_GetVtable(__pyx_ptype_6ctabix_tabix_copy_iterator->tp_dict); if (unlikely(!__pyx_vtabptr_6ctabix_tabix_copy_iterator)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_10TabProxies_GTFProxy = __Pyx_ImportType("TabProxies", "GTFProxy", sizeof(struct __pyx_obj_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_vtabptr_10TabProxies_GTFProxy = (struct __pyx_vtabstruct_10TabProxies_GTFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_GTFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_vtabptr_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_vtabptr_10TabProxies_BedProxy = (struct __pyx_vtabstruct_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_vtabptr_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_BedProxy = (struct __pyx_vtabstruct_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_vtabptr_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   /*--- Execution code ---*/
diff --git a/pysam/version.py b/pysam/version.py
index 6755f3d..7e6b192 100644
--- a/pysam/version.py
+++ b/pysam/version.py
@@ -1,6 +1,6 @@
 # pysam versioning information
 
-__version__ = "0.7"
+__version__ = "0.7.1"
 
 __samtools_version__ = "0.1.18"
 
diff --git a/setup.cfg b/setup.cfg
index b9711b8..81d163a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,8 +1,8 @@
 [bdist_rpm]
-doc_files = README doc/*.html ChangeLog
 vendor = TDB
-packager = TDB <email at email.com>
+doc_files = README doc/*.html ChangeLog
 distribution-name = Red Hat Linux
+packager = TDB <email at email.com>
 requires = python
 
 [egg_info]
diff --git a/setup.py b/setup.py
index 979b936..a1b8de8 100644
--- a/setup.py
+++ b/setup.py
@@ -114,14 +114,30 @@ if len(sys.argv) >= 2 and sys.argv[1] == "refresh":
 
     sys.exit(0)
 
-
-
 from distribute_setup import use_setuptools
 use_setuptools()
 
 from setuptools import Extension, setup
-from Cython.Distutils import build_ext
 
+#######################################################
+#######################################################
+try:
+    from Cython.Distutils import build_ext
+except ImportError:
+    # no Cython available - use existing C code
+    cmdclass = { }
+    csamtools_sources = [ "pysam/csamtools.c" ]
+    tabix_sources = [ "pysam/tabix.c" ]
+    tabproxies_sourcess = ["pysam/TabProxies.c" ]
+    cvcf_sources = ["pysam/cvcf.c" ]
+else:
+    cmdclass = { 'build_ext' : build_ext }
+    csamtools_sources = [ "pysam/csamtools.pyx" ]
+    tabix_sources = [ "pysam/ctabix.pyx" ]
+    tabproxies_sources = ["pysam/TabProxies.pyx" ]
+    cvcf_sources = ["pysam/cvcf.pyx" ]
+
+#######################################################
 classifiers = """
 Development Status :: 2 - Alpha
 Operating System :: MacOS :: MacOS X
@@ -135,6 +151,8 @@ Topic :: Scientific/Engineering
 Topic :: Scientific/Engineering :: Bioinformatics
 """
 
+#######################################################
+## Windows compatibility
 if platform.system()=='Windows':
     include_os = ['win32']
     os_c_files = ['win32/getopt.c']
@@ -142,9 +160,10 @@ else:
     include_os = []
     os_c_files = []
 
+#######################################################
 samtools = Extension(
-    "csamtools",                   # name of extension
-    [ "pysam/csamtools.pyx" ]  +\
+    "csamtools",              
+    csamtools_sources +\
         [ "pysam/%s" % x for x in (
                 "pysam_util.c", )] +\
         glob.glob( os.path.join( "samtools", "*.pysam.c" )) +\
@@ -159,8 +178,8 @@ samtools = Extension(
     )
 
 tabix = Extension(
-    "ctabix",                   # name of extension
-    [ "pysam/ctabix.pyx", ]  +\
+    "ctabix",                   
+    tabix_sources +\
        [ "pysam/%s" % x for x in ( "tabix_util.c", )] +\
         os_c_files + \
        glob.glob( os.path.join( "tabix", "*.pysam.c" ) ),
@@ -173,8 +192,8 @@ tabix = Extension(
     )
 
 tabproxies = Extension(
-    "TabProxies",                   # name of extension
-    [ "pysam/TabProxies.pyx", ] + os_c_files,
+    "TabProxies",               
+    tabproxies_sources + os_c_files,
     library_dirs=[],
     include_dirs= include_os,
     libraries=[ "z", ],
@@ -182,8 +201,8 @@ tabproxies = Extension(
     )
 
 cvcf = Extension(
-    "cvcf",                   # name of extension
-    [ "pysam/cvcf.pyx", ] + os_c_files,
+    "cvcf",                   
+    cvcf_sources + os_c_files,
     library_dirs=[],
     include_dirs= ["tabix",] + include_os,
     libraries=[ "z", ],
@@ -207,7 +226,7 @@ metadata = {
     # cython larger that 0.16 for yield support
     'requires' : ['cython (>=0.16)'],
     'ext_modules': [samtools, tabix, tabproxies, cvcf ],
-    'cmdclass' : {'build_ext': build_ext},
+    'cmdclass' : cmdclass,
     'install_requires' : ['cython>=0.12.1',], 
     # do not pack in order to permit linking to csamtools.so
     'zip_safe' :False,
diff --git a/tests/example_btag.bam b/tests/example_btag.bam
new file mode 100644
index 0000000..7cd5c0c
Binary files /dev/null and b/tests/example_btag.bam differ
diff --git a/tests/pysam_test.py b/tests/pysam_test.py
index 3407182..c8acf83 100755
--- a/tests/pysam_test.py
+++ b/tests/pysam_test.py
@@ -891,6 +891,16 @@ class TestHeaderBam(TestHeaderSam):
         self.samfile=pysam.Samfile( "ex3.bam","rb" )
 
 
+class TestHeader1000Genomes( unittest.TestCase ):
+
+    bamfile = "http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/phase2b_alignment/data/NA07048/exome_alignment/NA07048.unmapped.ILLUMINA.bwa.CEU.exome.20120522_p2b.bam"
+        
+    def testRead( self ):
+
+        f = pysam.Samfile( self.bamfile, "rb" )
+        data = f.header.copy()
+        self.assertTrue( data )
+
 class TestUnmappedReads(unittest.TestCase):
 
     def testSAM(self):

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/pysam.git



More information about the debian-med-commit mailing list