[med-svn] [pysam] 07/13: Imported Upstream version 0.7.4

Charles Plessy plessy at alioth.debian.org
Fri Aug 9 09:47:30 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 356c1c89be26c412e68323cc506e42159ff4b74d
Author: Charles Plessy <plessy at debian.org>
Date:   Fri Aug 9 18:34:36 2013 +0900

    Imported Upstream version 0.7.4
---
 PKG-INFO                   |    2 +-
 pysam.egg-info/PKG-INFO    |    2 +-
 pysam.egg-info/SOURCES.txt |    7 +-
 pysam/TabProxies.c         |    4 +-
 pysam/VCF.py               | 1087 ---
 pysam/__init__.py          |    9 +-
 pysam/alternatives.py      |   82 -
 pysam/csamtools.c          |22245 +++++++++++++++++++-------------------------
 pysam/ctabix.c             | 1300 ++-
 pysam/cvcf.c               | 5735 +++++-------
 pysam/version.py           |    2 +-
 setup.cfg                  |    4 +-
 setup.py                   |   12 +-
 13 files changed, 12431 insertions(+), 18060 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 905bd25..c527383 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pysam
-Version: 0.7.3
+Version: 0.7.4
 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 905bd25..c527383 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.3
+Version: 0.7.4
 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 8a914d5..718c4d2 100644
--- a/pysam.egg-info/SOURCES.txt
+++ b/pysam.egg-info/SOURCES.txt
@@ -10,9 +10,7 @@ pysam/Pileup.py
 pysam/TabProxies.c
 pysam/TabProxies.pxd
 pysam/TabProxies.pyx
-pysam/VCF.py
 pysam/__init__.py
-pysam/alternatives.py
 pysam/csamtools.c
 pysam/csamtools.pxd
 pysam/csamtools.pyx
@@ -33,6 +31,8 @@ pysam.egg-info/dependency_links.txt
 pysam.egg-info/not-zip-safe
 pysam.egg-info/requires.txt
 pysam.egg-info/top_level.txt
+pysam/include/__init__.py
+samtools/__init__.py
 samtools/bam.c.pysam.c
 samtools/bam.h
 samtools/bam2bcf.c.pysam.c
@@ -87,6 +87,7 @@ samtools/sam_header.h
 samtools/sam_view.c.pysam.c
 samtools/sample.c.pysam.c
 samtools/sample.h
+samtools/bcftools/__init__.py
 samtools/bcftools/bcf.c.pysam.c
 samtools/bcftools/bcf.h
 samtools/bcftools/bcf2qcall.c.pysam.c
@@ -105,9 +106,11 @@ samtools/bcftools/vcf.c.pysam.c
 samtools/misc/md5.c.pysam.c
 samtools/misc/md5.h
 samtools/misc/seqtk.c.pysam.c
+samtools/win32/__init__.py
 samtools/win32/xcurses.h
 samtools/win32/zconf.h
 samtools/win32/zlib.h
+tabix/__init__.py
 tabix/bam_endian.h
 tabix/bedidx.c
 tabix/bedidx.c.pysam.c
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 e1d87ee..7e36c08 100644
--- a/pysam/__init__.py
+++ b/pysam/__init__.py
@@ -127,8 +127,15 @@ __all__ = \
 
 from pysam.version import __version__, __samtools_version__
 
+###########################################################
+# Utility functions for compilation
 def get_include():
-    return [os.path.abspath(os.path.join(os.path.dirname(__file__), 'include'))]
+    '''return a list of include directories.'''
+    dirname = os.path.abspath(os.path.join(os.path.dirname(__file__)))
+    return [ dirname,
+             os.path.join(dirname, 'include', 'samtools'),
+             os.path.join(dirname, 'include', 'tabix') ]
 
 def get_defines():
+    '''return a list of defined compilation parameters.'''
     return [('_FILE_OFFSET_BITS','64'), ('_USE_KNETFILE','')]
diff --git a/pysam/alternatives.py b/pysam/alternatives.py
deleted file mode 100644
index fd76802..0000000
--- a/pysam/alternatives.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# This file contains an alternative implementation
-# to call samtools functions. These are direct calls.
-# Plus: less overhead
-# Minus: more trouble in maintaining
-
-#in csamtools.pxd
-    # samtools toolkit functions
-    ctypedef int (*pysam_samtools_f)(int argc, char *argv[])
-
-    int bam_taf2baf(int argc, char *argv[])
-    int bam_pileup(int argc, char *argv[])
-    int bam_merge(int argc, char *argv[])
-    int bam_index(int argc, char *argv[])
-    int bam_sort(int argc, char *argv[])
-    int bam_tview_main(int argc, char *argv[])
-    int bam_mating(int argc, char *argv[])
-    int bam_rmdup(int argc, char *argv[])
-    int bam_rmdupse(int argc, char *argv[])
-    int bam_flagstat(int argc, char *argv[])
-    int bam_fillmd(int argc, char *argv[])
-    int main_samview(int argc, char *argv[])
-    int main_import(int argc, char *argv[])
-    int faidx_main(int argc, char *argv[])
-    int glf3_view_main(int argc, char *argv[])
-
-
-## Alternative code in csamtools.pyx
-cdef class SamtoolsWrapper:
-    '''generic wrapper around samtools functions'''
-    cdef pysam_samtools_f f 
-
-    def __init__(self): self.f = NULL
-
-    def call(self, *args ):
-
-        if self.f == NULL: raise NotImplementedError("invalid call to base class" )
-
-        cdef char ** cargs
-        cdef int i, n, retval
-        n = len(args)
-        # allocate one more for first (dummy) argument (contains command)
-        cargs = <char**>calloc( n+1, sizeof( char *) )
-        cargs[0] = "method"
-        for i from 0 <= i < n:
-            cargs[i+1] = args[i]
-        for i from 0 <= i < n+1:
-            print cargs[i]
-        retval = self.f(n+1, cargs)
-        free( cargs )
-        return retval
-
-cdef class SamtoolsWrapperImport( SamtoolsWrapper ):
-    def __init__(self): self.f = main_import
-cdef class SamtoolsWrapperPileup( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_pileup
-cdef class SamtoolsWrapperMerge( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_merge
-cdef class SamtoolsWrapperSort( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_sort
-cdef class SamtoolsWrapperIndex( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_index
-cdef class SamtoolsWrapperFaidx( SamtoolsWrapper ):
-    def __init__(self): self.f = faidx_main
-cdef class SamtoolsWrapperFixMate( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_mating
-cdef class SamtoolsWrapperRmDup( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_rmdup
-cdef class SamtoolsWrapperRmDupSe( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_rmdupse
-cdef class SamtoolsWrapperGlf3Viwen( SamtoolsWrapper ):
-    def __init__(self): self.f = glf3_view_main
-cdef class SamtoolsWrapperFlagStat( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_flagstat
-cdef class SamtoolsWrapperFillMd( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_fillmd
-cdef class SamtoolsWrapperCalMd( SamtoolsWrapper ):
-    def __init__(self): self.f = bam_fillmd
-
-automatic creation of these functions does not work 
-due to pyrex/cython
-
-def sort( *args, **kwargs ): return SamtoolsWrapperSort().call(*args, **kwargs)
diff --git a/pysam/csamtools.c b/pysam/csamtools.c
index e79d3c8..35b4522 100644
--- a/pysam/csamtools.c
+++ b/pysam/csamtools.c
@@ -1,16 +1,16 @@
-/* Generated by Cython 0.17.2 on Wed Jan 23 09:18:14 2013 */
+/* 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 )
 #endif
+
 #if !defined(WIN32) && !defined(MS_WINDOWS)
   #ifndef __stdcall
     #define __stdcall
@@ -22,47 +22,36 @@
     #define __fastcall
   #endif
 #endif
+
 #ifndef DL_IMPORT
   #define DL_IMPORT(t) t
 #endif
 #ifndef DL_EXPORT
   #define DL_EXPORT(t) t
 #endif
+
 #ifndef PY_LONG_LONG
   #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
+
+#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
   typedef int Py_ssize_t;
   #define PY_SSIZE_T_MAX INT_MAX
   #define PY_SSIZE_T_MIN INT_MIN
   #define PY_FORMAT_SIZE_T ""
-  #define CYTHON_FORMAT_SSIZE_T ""
   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
   #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
-  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
-                                (PyErr_Format(PyExc_TypeError, \
-                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
-                                 (PyObject*)0))
-  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
-                                  !PyComplex_Check(o))
-  #define PyIndex_Check __Pyx_PyIndex_Check
+  #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"
-  #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)
   #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
@@ -70,6 +59,7 @@
   #define PyVarObject_HEAD_INIT(type, size) \
           PyObject_HEAD_INIT(type) size,
   #define PyType_Modified(t)
+
   typedef struct {
      void *buf;
      PyObject *obj;
@@ -83,6 +73,7 @@
      Py_ssize_t *suboffsets;
      void *internal;
   } Py_buffer;
+
   #define PyBUF_SIMPLE 0
   #define PyBUF_WRITABLE 0x0001
   #define PyBUF_FORMAT 0x0004
@@ -92,44 +83,24 @@
   #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
   #define Py_TPFLAGS_CHECKTYPES 0
   #define Py_TPFLAGS_HAVE_INDEX 0
 #endif
+
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
-#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
-  #define CYTHON_PEP393_ENABLED 1
-  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
-                                              0 : _PyUnicode_Ready((PyObject *)(op)))
-  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
-  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
-  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
-#else
-  #define CYTHON_PEP393_ENABLED 0
-  #define __Pyx_PyUnicode_READY(op)       (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]))
-  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
-#endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyBaseString_Type            PyUnicode_Type
   #define PyStringObject               PyUnicodeObject
@@ -137,6 +108,7 @@
   #define PyString_Check               PyUnicode_Check
   #define PyString_CheckExact          PyUnicode_CheckExact
 #endif
+
 #if PY_VERSION_HEX < 0x02060000
   #define PyBytesObject                PyStringObject
   #define PyBytes_Type                 PyString_Type
@@ -155,6 +127,7 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -162,7 +135,9 @@
 #ifndef PySet_CheckExact
   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
+
 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
 #if PY_MAJOR_VERSION >= 3
   #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
@@ -179,9 +154,11 @@
   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 #endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyBoolObject                 PyLongObject
 #endif
+
 #if PY_VERSION_HEX < 0x03020000
   typedef long Py_hash_t;
   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
@@ -190,6 +167,16 @@
   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
   #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)
@@ -208,9 +195,11 @@
         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
             (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
 #endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
+
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
@@ -220,6 +209,7 @@
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
 #endif
+
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_NAMESTR(n) ((char *)(n))
   #define __Pyx_DOCSTR(n)  ((char *)(n))
@@ -228,15 +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"
@@ -249,8 +230,8 @@
 #define _USE_MATH_DEFINES
 #endif
 #include <math.h>
-#define __PYX_HAVE__pysam__csamtools
-#define __PYX_HAVE_API__pysam__csamtools
+#define __PYX_HAVE__csamtools
+#define __PYX_HAVE_API__csamtools
 #include "string.h"
 #include "stdlib.h"
 #include "math.h"
@@ -294,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
@@ -318,12 +299,8 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
-#if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
-#else
-#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
-#endif
-#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -351,43 +328,50 @@ static const char *__pyx_filename;
 
 static const char *__pyx_f[] = {
   "csamtools.pyx",
-  "type.pxd",
   "bool.pxd",
   "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_obj_5pysam_9csamtools_IteratorRow;
-struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs;
-struct __pyx_obj_5pysam_9csamtools_Samfile;
-struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection;
-struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr;
-struct __pyx_obj_5pysam_9csamtools_Fastafile;
-struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion;
-struct __pyx_obj_5pysam_9csamtools_IteratorColumn;
-struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion;
-struct __pyx_obj_5pysam_9csamtools_IteratorRowAll;
-struct __pyx_obj_5pysam_9csamtools_IndexedReads;
-struct __pyx_obj_5pysam_9csamtools_SNPCall;
-struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr;
-struct __pyx_obj_5pysam_9csamtools_AlignedRead;
-struct __pyx_obj_5pysam_9csamtools_PileupProxy;
-struct __pyx_obj_5pysam_9csamtools_PileupRead;
-struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs;
-struct __pyx_t_5pysam_9csamtools___iterdata;
-typedef struct __pyx_t_5pysam_9csamtools___iterdata __pyx_t_5pysam_9csamtools___iterdata;
-struct __pyx_opt_args_5pysam_9csamtools_14IteratorColumn_setupIteratorData;
-struct __pyx_t_5pysam_9csamtools_MateData;
-typedef struct __pyx_t_5pysam_9csamtools_MateData __pyx_t_5pysam_9csamtools_MateData;
-
-/* "pysam/csamtools.pxd":394
+struct __pyx_Generator_object;
+struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr;
+struct __pyx_obj_9csamtools_IteratorRow;
+struct __pyx_obj_9csamtools_IteratorRowAllRefs;
+struct __pyx_obj_9csamtools_IteratorRowAll;
+struct __pyx_obj_9csamtools_PileupProxy;
+struct __pyx_obj_9csamtools_AlignedRead;
+struct __pyx_obj_9csamtools_Fastafile;
+struct __pyx_obj_9csamtools_IteratorRowSelection;
+struct __pyx_obj_9csamtools_IteratorColumn;
+struct __pyx_obj_9csamtools_IteratorColumnAllRefs;
+struct __pyx_obj_9csamtools_IteratorRowRegion;
+struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr;
+struct __pyx_obj_9csamtools_Samfile;
+struct __pyx_obj_9csamtools_SNPCall;
+struct __pyx_obj_9csamtools_IndexedReads;
+struct __pyx_obj_9csamtools_IteratorColumnRegion;
+struct __pyx_obj_9csamtools_PileupRead;
+struct __pyx_t_9csamtools___iterdata;
+typedef struct __pyx_t_9csamtools___iterdata __pyx_t_9csamtools___iterdata;
+struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData;
+struct __pyx_t_9csamtools_MateData;
+typedef struct __pyx_t_9csamtools_MateData __pyx_t_9csamtools_MateData;
+
+/* "csamtools.pxd":394
  * # Utility types
  * 
  * ctypedef struct __iterdata:             # <<<<<<<<<<<<<<
  *     samfile_t * samfile
  *     bam_iter_t iter
  */
-struct __pyx_t_5pysam_9csamtools___iterdata {
+struct __pyx_t_9csamtools___iterdata {
   samfile_t *samfile;
   bam_iter_t iter;
   faidx_t *fastafile;
@@ -396,229 +380,266 @@ struct __pyx_t_5pysam_9csamtools___iterdata {
   int seq_len;
 };
 
-/* "pysam/csamtools.pxd":523
+/* "csamtools.pxd":523
  *     cdef char * getSequence( self )
  *     cdef setMask( self, mask )
  *     cdef setupIteratorData( self,             # <<<<<<<<<<<<<<
  *                             int tid,
  *                             int start,
  */
-struct __pyx_opt_args_5pysam_9csamtools_14IteratorColumn_setupIteratorData {
+struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData {
   int __pyx_n;
   int reopen;
 };
 
-/* "pysam/csamtools.pyx":518
+/* "csamtools.pyx":518
  *      counter[0] += 1;
  * 
  * ctypedef struct MateData:             # <<<<<<<<<<<<<<
  *      char * name
  *      bam1_t * mate
  */
-struct __pyx_t_5pysam_9csamtools_MateData {
+struct __pyx_t_9csamtools_MateData {
   char *name;
   bam1_t *mate;
   uint32_t flag;
 };
 
-/* "pysam/csamtools.pxd":464
+/* "csamtools.pyx":140
+ * cdef char* CODE2CIGAR= "MIDNSHP=X"
+ * if IS_PYTHON3:
+ *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )             # <<<<<<<<<<<<<<
+ * else:
+ *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
+ */
+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;
+  PyObject *__pyx_t_1;
+  PyObject *(*__pyx_t_2)(PyObject *);
+};
+
+
+/* "csamtools.pxd":464
  *     cdef uint32_t _is_tail
  * 
  * cdef class IteratorRow:             # <<<<<<<<<<<<<<
  *     pass
  * 
  */
-struct __pyx_obj_5pysam_9csamtools_IteratorRow {
+struct __pyx_obj_9csamtools_IteratorRow {
   PyObject_HEAD
 };
 
 
-/* "pysam/csamtools.pxd":487
+/* "csamtools.pxd":487
  *     cdef int cnext(self)
  * 
  * cdef class IteratorRowAllRefs(IteratorRow):             # <<<<<<<<<<<<<<
  *     cdef Samfile     samfile
  *     cdef int         tid
  */
-struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRow __pyx_base;
-  struct __pyx_obj_5pysam_9csamtools_Samfile *samfile;
+struct __pyx_obj_9csamtools_IteratorRowAllRefs {
+  struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
+  struct __pyx_obj_9csamtools_Samfile *samfile;
   int tid;
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *rowiter;
+  struct __pyx_obj_9csamtools_IteratorRowRegion *rowiter;
 };
 
 
-/* "pysam/csamtools.pxd":420
- *     cdef bam1_t * _delegate
+/* "csamtools.pxd":480
+ *     cdef int cnext(self)
  * 
- * cdef class Samfile:             # <<<<<<<<<<<<<<
- *     cdef char * _filename
- *     # pointer to samfile
+ * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
+ *     cdef bam1_t * b
+ *     cdef samfile_t * fp
  */
-struct __pyx_obj_5pysam_9csamtools_Samfile {
-  PyObject_HEAD
-  struct __pyx_vtabstruct_5pysam_9csamtools_Samfile *__pyx_vtab;
-  char *_filename;
-  samfile_t *samfile;
-  bam_index_t *index;
-  int isbam;
-  int isstream;
-  int isremote;
+struct __pyx_obj_9csamtools_IteratorRowAll {
+  struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
+  struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtab;
   bam1_t *b;
-  char *mode;
-  int64_t start_offset;
+  samfile_t *fp;
+  int owns_samfile;
 };
 
 
-/* "pysam/csamtools.pxd":492
- *     cdef IteratorRowRegion rowiter
+/* "csamtools.pxd":449
+ *     cdef char * _getrname( self, int tid )
  * 
- * cdef class IteratorRowSelection(IteratorRow):             # <<<<<<<<<<<<<<
- *     cdef bam1_t * b
- *     cdef int current_pos
+ * cdef class PileupProxy:             # <<<<<<<<<<<<<<
+ *     cdef bam_pileup1_t ** plp
+ *     cdef int tid
  */
-struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRow __pyx_base;
-  struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowSelection *__pyx_vtab;
-  bam1_t *b;
-  int current_pos;
-  samfile_t *fp;
-  PyObject *positions;
-  int owns_samfile;
+struct __pyx_obj_9csamtools_PileupProxy {
+  PyObject_HEAD
+  bam_pileup1_t **plp;
+  int tid;
+  int pos;
+  int n_pu;
 };
 
 
-/* "pysam/csamtools.pyx":142
- *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
- * else:
- *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )             # <<<<<<<<<<<<<<
- * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )
+/* "csamtools.pxd":415
+ *     cdef char * _fetch( self, char * reference, int start, int end, int * length )
+ * 
+ * cdef class AlignedRead:             # <<<<<<<<<<<<<<
  * 
+ *     # object that this AlignedRead represents
  */
-struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr {
+struct __pyx_obj_9csamtools_AlignedRead {
   PyObject_HEAD
-  PyObject *__pyx_v_x;
-  PyObject *__pyx_v_y;
-  PyObject *__pyx_t_0;
-  PyObject *__pyx_t_1;
-  PyObject *(*__pyx_t_2)(PyObject *);
+  bam1_t *_delegate;
 };
 
 
-/* "pysam/csamtools.pxd":408
+/* "csamtools.pxd":408
  * # Note: need to declare all C fields and methods here
  * #
  * cdef class Fastafile:             # <<<<<<<<<<<<<<
  *     cdef char * _filename
  *     # pointer to fastafile
  */
-struct __pyx_obj_5pysam_9csamtools_Fastafile {
+struct __pyx_obj_9csamtools_Fastafile {
   PyObject_HEAD
-  struct __pyx_vtabstruct_5pysam_9csamtools_Fastafile *__pyx_vtab;
+  struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtab;
   char *_filename;
   faidx_t *fastafile;
 };
 
 
-/* "pysam/csamtools.pxd":467
- *     pass
+/* "csamtools.pxd":492
+ *     cdef IteratorRowRegion rowiter
  * 
- * cdef class IteratorRowRegion(IteratorRow):             # <<<<<<<<<<<<<<
- *     cdef bam_iter_t             iter # iterator state object
- *     cdef bam1_t *               b
+ * cdef class IteratorRowSelection(IteratorRow):             # <<<<<<<<<<<<<<
+ *     cdef bam1_t * b
+ *     cdef int current_pos
  */
-struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRow __pyx_base;
-  struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowRegion *__pyx_vtab;
-  bam_iter_t iter;
+struct __pyx_obj_9csamtools_IteratorRowSelection {
+  struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
+  struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtab;
   bam1_t *b;
-  int retval;
-  struct __pyx_obj_5pysam_9csamtools_Samfile *samfile;
+  int current_pos;
   samfile_t *fp;
+  PyObject *positions;
   int owns_samfile;
 };
 
 
-/* "pysam/csamtools.pxd":504
+/* "csamtools.pxd":504
  *     cdef int cnext(self)
  * 
  * cdef class IteratorColumn:             # <<<<<<<<<<<<<<
  * 
  *     # result of the last plbuf_push
  */
-struct __pyx_obj_5pysam_9csamtools_IteratorColumn {
+struct __pyx_obj_9csamtools_IteratorColumn {
   PyObject_HEAD
-  struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumn *__pyx_vtab;
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *iter;
+  struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtab;
+  struct __pyx_obj_9csamtools_IteratorRowRegion *iter;
   int tid;
   int pos;
   int n_plp;
   int mask;
   const bam_pileup1_t * plp;
   bam_plp_t pileup_iter;
-  __pyx_t_5pysam_9csamtools___iterdata iterdata;
-  struct __pyx_obj_5pysam_9csamtools_Samfile *samfile;
-  struct __pyx_obj_5pysam_9csamtools_Fastafile *fastafile;
+  __pyx_t_9csamtools___iterdata iterdata;
+  struct __pyx_obj_9csamtools_Samfile *samfile;
+  struct __pyx_obj_9csamtools_Fastafile *fastafile;
   PyObject *stepper;
   int max_depth;
 };
 
 
-/* "pysam/csamtools.pxd":531
- *     cdef reset( self, tid, start, end )
+/* "csamtools.pxd":536
+ *     cdef int truncate
+ * 
+ * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
+ *     pass
  * 
- * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
- *     cdef int start
- *     cdef int end
  */
-struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion {
-  struct __pyx_obj_5pysam_9csamtools_IteratorColumn __pyx_base;
-  int start;
-  int end;
-  int truncate;
+struct __pyx_obj_9csamtools_IteratorColumnAllRefs {
+  struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
 };
 
 
-/* "pysam/csamtools.pxd":480
- *     cdef int cnext(self)
+/* "csamtools.pxd":467
+ *     pass
  * 
- * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
- *     cdef bam1_t * b
- *     cdef samfile_t * fp
+ * cdef class IteratorRowRegion(IteratorRow):             # <<<<<<<<<<<<<<
+ *     cdef bam_iter_t             iter # iterator state object
+ *     cdef bam1_t *               b
  */
-struct __pyx_obj_5pysam_9csamtools_IteratorRowAll {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRow __pyx_base;
-  struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowAll *__pyx_vtab;
+struct __pyx_obj_9csamtools_IteratorRowRegion {
+  struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
+  struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtab;
+  bam_iter_t iter;
   bam1_t *b;
+  int retval;
+  struct __pyx_obj_9csamtools_Samfile *samfile;
   samfile_t *fp;
   int owns_samfile;
 };
 
 
-/* "pysam/csamtools.pxd":539
- *     pass
+/* "csamtools.pyx":142
+ *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
+ * else:
+ *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )             # <<<<<<<<<<<<<<
+ * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )
  * 
- * cdef class IndexedReads:             # <<<<<<<<<<<<<<
- *     cdef Samfile samfile
- *     cdef samfile_t * fp
  */
-struct __pyx_obj_5pysam_9csamtools_IndexedReads {
+struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr {
+  struct __pyx_Generator_object __pyx_base;
+  PyObject *__pyx_v_x;
+  PyObject *__pyx_v_y;
+  PyObject *__pyx_t_0;
+  PyObject *__pyx_t_1;
+  PyObject *(*__pyx_t_2)(PyObject *);
+};
+
+
+/* "csamtools.pxd":420
+ *     cdef bam1_t * _delegate
+ * 
+ * cdef class Samfile:             # <<<<<<<<<<<<<<
+ *     cdef char * _filename
+ *     # pointer to samfile
+ */
+struct __pyx_obj_9csamtools_Samfile {
   PyObject_HEAD
-  struct __pyx_obj_5pysam_9csamtools_Samfile *samfile;
-  samfile_t *fp;
-  PyObject *index;
-  int owns_samfile;
+  struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtab;
+  char *_filename;
+  samfile_t *samfile;
+  bam_index_t *index;
+  int isbam;
+  int isstream;
+  int isremote;
+  bam1_t *b;
+  char *mode;
+  int64_t start_offset;
 };
 
 
-/* "pysam/csamtools.pyx":3222
+/* "csamtools.pyx":3222
  *     return retval, out_stderr, out_stdout
  * 
  * cdef class SNPCall:             # <<<<<<<<<<<<<<
  *     '''the results of a SNP call.'''
  *     cdef int _tid
  */
-struct __pyx_obj_5pysam_9csamtools_SNPCall {
+struct __pyx_obj_9csamtools_SNPCall {
   PyObject_HEAD
   int _tid;
   int _pos;
@@ -631,62 +652,47 @@ struct __pyx_obj_5pysam_9csamtools_SNPCall {
 };
 
 
-/* "pysam/csamtools.pyx":140
- * cdef char* CODE2CIGAR= "MIDNSHP=X"
- * if IS_PYTHON3:
- *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )             # <<<<<<<<<<<<<<
- * else:
- *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
- */
-struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr {
-  PyObject_HEAD
-  PyObject *__pyx_v_x;
-  PyObject *__pyx_v_y;
-  PyObject *__pyx_t_0;
-  PyObject *__pyx_t_1;
-  PyObject *(*__pyx_t_2)(PyObject *);
-};
-
-
-/* "pysam/csamtools.pxd":415
- *     cdef char * _fetch( self, char * reference, int start, int end, int * length )
- * 
- * cdef class AlignedRead:             # <<<<<<<<<<<<<<
+/* "csamtools.pxd":539
+ *     pass
  * 
- *     # object that this AlignedRead represents
+ * cdef class IndexedReads:             # <<<<<<<<<<<<<<
+ *     cdef Samfile samfile
+ *     cdef samfile_t * fp
  */
-struct __pyx_obj_5pysam_9csamtools_AlignedRead {
+struct __pyx_obj_9csamtools_IndexedReads {
   PyObject_HEAD
-  bam1_t *_delegate;
+  struct __pyx_obj_9csamtools_Samfile *samfile;
+  samfile_t *fp;
+  PyObject *index;
+  int owns_samfile;
 };
 
 
-/* "pysam/csamtools.pxd":449
- *     cdef char * _getrname( self, int tid )
+/* "csamtools.pxd":531
+ *     cdef reset( self, tid, start, end )
  * 
- * cdef class PileupProxy:             # <<<<<<<<<<<<<<
- *     cdef bam_pileup1_t ** plp
- *     cdef int tid
+ * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
+ *     cdef int start
+ *     cdef int end
  */
-struct __pyx_obj_5pysam_9csamtools_PileupProxy {
-  PyObject_HEAD
-  bam_pileup1_t **plp;
-  int tid;
-  int pos;
-  int n_pu;
+struct __pyx_obj_9csamtools_IteratorColumnRegion {
+  struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
+  int start;
+  int end;
+  int truncate;
 };
 
 
-/* "pysam/csamtools.pxd":455
+/* "csamtools.pxd":455
  *     cdef int n_pu
  * 
  * cdef class PileupRead:             # <<<<<<<<<<<<<<
  *     cdef AlignedRead _alignment
  *     cdef int32_t  _qpos
  */
-struct __pyx_obj_5pysam_9csamtools_PileupRead {
+struct __pyx_obj_9csamtools_PileupRead {
   PyObject_HEAD
-  struct __pyx_obj_5pysam_9csamtools_AlignedRead *_alignment;
+  struct __pyx_obj_9csamtools_AlignedRead *_alignment;
   int32_t _qpos;
   int _indel;
   int _level;
@@ -696,20 +702,8 @@ struct __pyx_obj_5pysam_9csamtools_PileupRead {
 };
 
 
-/* "pysam/csamtools.pxd":536
- *     cdef int truncate
- * 
- * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
- *     pass
- * 
- */
-struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs {
-  struct __pyx_obj_5pysam_9csamtools_IteratorColumn __pyx_base;
-};
-
-
 
-/* "pysam/csamtools.pyx":1766
+/* "csamtools.pyx":1766
  *     return ret
  * 
  * cdef class IteratorColumn:             # <<<<<<<<<<<<<<
@@ -717,61 +711,61 @@ struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs {
  * 
  */
 
-struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumn {
-  int (*cnext)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *);
-  char *(*getSequence)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *);
-  PyObject *(*setMask)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *, PyObject *);
-  PyObject *(*setupIteratorData)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_5pysam_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args);
-  PyObject *(*reset)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *);
+struct __pyx_vtabstruct_9csamtools_IteratorColumn {
+  int (*cnext)(struct __pyx_obj_9csamtools_IteratorColumn *);
+  char *(*getSequence)(struct __pyx_obj_9csamtools_IteratorColumn *);
+  PyObject *(*setMask)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *);
+  PyObject *(*setupIteratorData)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args);
+  PyObject *(*reset)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *);
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumn *__pyx_vtabptr_5pysam_9csamtools_IteratorColumn;
+static struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtabptr_9csamtools_IteratorColumn;
 
 
-/* "pysam/csamtools.pyx":1540
- *         if self.owns_samfile: samclose( self.fp )
- * 
- * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
- *     """*(Samfile samfile, int reopen = True)*
+/* "csamtools.pyx":1931
+ *             self.iterdata.seq = NULL
  * 
+ * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
+ *     '''iterates over a region only.
+ *     '''
  */
 
-struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowAll {
-  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *);
-  int (*cnext)(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *);
+struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion {
+  struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_base;
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowAll *__pyx_vtabptr_5pysam_9csamtools_IteratorRowAll;
+static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *__pyx_vtabptr_9csamtools_IteratorColumnRegion;
 
 
-/* "pysam/csamtools.pyx":375
- * ## Public methods
- * ######################################################################
- * cdef class Fastafile:             # <<<<<<<<<<<<<<
- *     '''*(filename)*
+/* "csamtools.pyx":1461
+ * 
+ * 
+ * cdef class IteratorRowRegion(IteratorRow):             # <<<<<<<<<<<<<<
+ *     """*(Samfile samfile, int tid, int beg, int end, int reopen = True )*
  * 
  */
 
-struct __pyx_vtabstruct_5pysam_9csamtools_Fastafile {
-  char *(*_fetch)(struct __pyx_obj_5pysam_9csamtools_Fastafile *, char *, int, int, int *);
+struct __pyx_vtabstruct_9csamtools_IteratorRowRegion {
+  bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowRegion *);
+  int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowRegion *);
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_Fastafile *__pyx_vtabptr_5pysam_9csamtools_Fastafile;
+static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtabptr_9csamtools_IteratorRowRegion;
 
 
-/* "pysam/csamtools.pyx":1461
- * 
+/* "csamtools.pyx":1641
+ *                 raise StopIteration
  * 
- * cdef class IteratorRowRegion(IteratorRow):             # <<<<<<<<<<<<<<
- *     """*(Samfile samfile, int tid, int beg, int end, int reopen = True )*
+ * cdef class IteratorRowSelection(IteratorRow):             # <<<<<<<<<<<<<<
+ *     """*(Samfile samfile)*
  * 
  */
 
-struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowRegion {
-  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *);
-  int (*cnext)(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *);
+struct __pyx_vtabstruct_9csamtools_IteratorRowSelection {
+  bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowSelection *);
+  int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowSelection *);
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowRegion *__pyx_vtabptr_5pysam_9csamtools_IteratorRowRegion;
+static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtabptr_9csamtools_IteratorRowSelection;
 
 
-/* "pysam/csamtools.pyx":1968
+/* "csamtools.pyx":1968
  *                                      self.n_plp )
  * 
  * cdef class IteratorColumnAllRefs(IteratorColumn):             # <<<<<<<<<<<<<<
@@ -779,60 +773,62 @@ static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowRegion *__pyx_vtabpt
  *     """
  */
 
-struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnAllRefs {
-  struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumn __pyx_base;
+struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs {
+  struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_base;
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnAllRefs *__pyx_vtabptr_5pysam_9csamtools_IteratorColumnAllRefs;
+static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
 
 
-/* "pysam/csamtools.pyx":1641
- *                 raise StopIteration
+/* "csamtools.pyx":545
  * 
- * cdef class IteratorRowSelection(IteratorRow):             # <<<<<<<<<<<<<<
- *     """*(Samfile samfile)*
  * 
+ * cdef class Samfile:             # <<<<<<<<<<<<<<
+ *     '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,
+ *          add_sq_text = False, check_header = True, check_sq = True )*
  */
 
-struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowSelection {
-  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *);
-  int (*cnext)(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *);
+struct __pyx_vtabstruct_9csamtools_Samfile {
+  bam_header_t *(*_buildHeader)(struct __pyx_obj_9csamtools_Samfile *, PyObject *);
+  bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_Samfile *);
+  int (*cnext)(struct __pyx_obj_9csamtools_Samfile *);
+  int (*write)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch);
+  char *(*_getrname)(struct __pyx_obj_9csamtools_Samfile *, int);
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowSelection *__pyx_vtabptr_5pysam_9csamtools_IteratorRowSelection;
+static struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtabptr_9csamtools_Samfile;
 
 
-/* "pysam/csamtools.pyx":1931
- *             self.iterdata.seq = NULL
+/* "csamtools.pyx":375
+ * ## Public methods
+ * ######################################################################
+ * cdef class Fastafile:             # <<<<<<<<<<<<<<
+ *     '''*(filename)*
  * 
- * cdef class IteratorColumnRegion(IteratorColumn):             # <<<<<<<<<<<<<<
- *     '''iterates over a region only.
- *     '''
  */
 
-struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnRegion {
-  struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumn __pyx_base;
+struct __pyx_vtabstruct_9csamtools_Fastafile {
+  char *(*_fetch)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *);
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnRegion *__pyx_vtabptr_5pysam_9csamtools_IteratorColumnRegion;
+static struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtabptr_9csamtools_Fastafile;
 
 
-/* "pysam/csamtools.pyx":545
+/* "csamtools.pyx":1540
+ *         if self.owns_samfile: samclose( self.fp )
  * 
+ * cdef class IteratorRowAll(IteratorRow):             # <<<<<<<<<<<<<<
+ *     """*(Samfile samfile, int reopen = True)*
  * 
- * cdef class Samfile:             # <<<<<<<<<<<<<<
- *     '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,
- *          add_sq_text = False, check_header = True, check_sq = True )*
  */
 
-struct __pyx_vtabstruct_5pysam_9csamtools_Samfile {
-  bam_header_t *(*_buildHeader)(struct __pyx_obj_5pysam_9csamtools_Samfile *, PyObject *);
-  bam1_t *(*getCurrent)(struct __pyx_obj_5pysam_9csamtools_Samfile *);
-  int (*cnext)(struct __pyx_obj_5pysam_9csamtools_Samfile *);
-  int (*write)(struct __pyx_obj_5pysam_9csamtools_Samfile *, struct __pyx_obj_5pysam_9csamtools_AlignedRead *, int __pyx_skip_dispatch);
-  char *(*_getrname)(struct __pyx_obj_5pysam_9csamtools_Samfile *, int);
+struct __pyx_vtabstruct_9csamtools_IteratorRowAll {
+  bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowAll *);
+  int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowAll *);
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_Samfile *__pyx_vtabptr_5pysam_9csamtools_Samfile;
+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);
@@ -845,21 +841,8 @@ static struct __pyx_vtabstruct_5pysam_9csamtools_Samfile *__pyx_vtabptr_5pysam_9
   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__)
@@ -870,7 +853,7 @@ static struct __pyx_vtabstruct_5pysam_9csamtools_Samfile *__pyx_vtabptr_5pysam_9
   #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)
@@ -881,21 +864,23 @@ static struct __pyx_vtabstruct_5pysam_9csamtools_Samfile *__pyx_vtabptr_5pysam_9
   #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
@@ -903,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();                                      \
@@ -920,25 +908,25 @@ 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 PyObject* __Pyx_decode_c_string(
-         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
-         const char* encoding, const char* errors,
-         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
+#endif /* CYTHON_PROFILE */
 
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
@@ -954,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*/
@@ -970,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;
@@ -977,107 +966,79 @@ 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 CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+            PyObject *r = PyList_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
 }
+
 #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 CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#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 CYTHON_COMPILING_IN_CPYTHON
-    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);
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, i);
             Py_INCREF(r);
             return 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);
+        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
             Py_INCREF(r);
             return r;
         }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
     }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
 
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
-    PyListObject* L = (PyListObject*) list;
-    Py_ssize_t len = Py_SIZE(list);
-    if (likely(L->allocated > len)) {
-        Py_INCREF(x);
-        PyList_SET_ITEM(list, len, x);
-        Py_SIZE(list) = len+1;
-        return 0;
+
+#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) {
+    PyObject *r;
+    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
     }
-    return PyList_Append(list, x);
+    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+    }
+    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
+        r = PySequence_GetItem(o, i);
+    }
+    else {
+        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+    }
+    return r;
 }
-#else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
-#endif
 
 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
     if (likely(PyList_CheckExact(L))) {
-        if (unlikely(PyList_Append(L, x) < 0)) return NULL;
+        if (PyList_Append(L, x) < 0) return NULL;
         Py_INCREF(Py_None);
         return Py_None; /* this is just to have an accurate signature */
-    } else {
+    }
+    else {
         PyObject *r, *m;
         m = __Pyx_GetAttrString(L, "append");
         if (!m) return NULL;
@@ -1087,27 +1048,28 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
     }
 }
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
-
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
 
-static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
+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_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
-    int result = PySequence_Contains(seq, item);
-    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
+    return unlikely(b < 0) ? b : !b; 
 }
-
-static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) {
-    int result = PyDict_Contains(dict, item);
-    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
+    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
 }
 
+static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
+
 #if PY_MAJOR_VERSION >= 3
 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     PyObject *value;
+    if (unlikely(d == Py_None)) {
+        __Pyx_RaiseNoneIndexingError();
+        return NULL;
+    }
     value = PyDict_GetItemWithError(d, key);
     if (unlikely(!value)) {
         if (!PyErr_Occurred())
@@ -1133,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;
@@ -1143,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
@@ -1159,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;
@@ -1166,29 +1130,16 @@ 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 CYTHON_COMPILING_IN_PYPY
-    if (PySequence_Check(o)) {
+    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);
     }
-#else
-    PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-    if (likely(m && m->sq_ass_item)) {
-        if (unlikely(i < 0) && likely(m->sq_length)) {
-            Py_ssize_t l = m->sq_length(o);
-            if (unlikely(l < 0)) return -1;
-            i += l;
-        }
-        return m->sq_ass_item(o, i, (PyObject *)NULL);
-    }
-#endif
-    return __Pyx_DelItem_Generic(o, PyInt_FromSsize_t(i));
 }
 
-static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);
-
-static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);
-
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
@@ -1199,51 +1150,29 @@ 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 CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject *);
+static PyTypeObject __pyx_binding_PyCFunctionType_type;
+static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;
 
-static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *);
+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*/
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int8_t(int8_t);
 
@@ -1257,8 +1186,12 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t);
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
 
+static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *);
+
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t);
 
+static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject *);
+
 static CYTHON_INLINE uint8_t __Pyx_PyInt_from_py_uint8_t(PyObject *);
 
 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
@@ -1299,33 +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>
-#include <frameobject.h>
-typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
-typedef struct {
-    PyObject_HEAD
-    __pyx_generator_body_t body;
-    PyObject *closure;
-    PyObject *exc_type;
-    PyObject *exc_value;
-    PyObject *exc_traceback;
-    PyObject *gi_weakreflist;
-    PyObject *classobj;
-    PyObject *yieldfrom;
-    int resume_label;
-    char is_running;  // using T_BOOL for property below requires char value
-} __pyx_GeneratorObject;
-static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
-                                                  PyObject *closure);
-static int __pyx_Generator_init(void);
-static int __Pyx_Generator_clear(PyObject* self);
-#if 1 || PY_VERSION_HEX < 0x030300B0
-static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
-#else
-#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
-#endif
-
 static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                   int lineno, const char *filename); /*proto*/
 
@@ -1333,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 PyObject *__Pyx_ImportModule(const char *name); /*proto*/
-
 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*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 PyObject *__Pyx_ImportModule(const char *name); /*proto*/
 
-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' */
@@ -1389,10 +1272,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.iterator' */
 
-/* Module declarations from '__builtin__' */
-
 /* Module declarations from 'cpython.type' */
-static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
 
 /* Module declarations from 'cpython.number' */
 
@@ -1446,53 +1326,54 @@ static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
 
 /* Module declarations from 'cpython' */
 
-/* Module declarations from 'pysam.csamtools' */
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_Fastafile = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_AlignedRead = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_Samfile = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_PileupProxy = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_PileupRead = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IteratorRow = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IteratorRowRegion = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IteratorRowAll = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IteratorRowAllRefs = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IteratorRowSelection = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IteratorColumn = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IteratorColumnRegion = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IteratorColumnAllRefs = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_IndexedReads = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools_SNPCall = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools___pyx_scope_struct__genexpr = 0;
-static PyTypeObject *__pyx_ptype_5pysam_9csamtools___pyx_scope_struct_1_genexpr = 0;
-static PyObject *__pyx_v_5pysam_9csamtools__FILENAME_ENCODING = 0;
-static char *__pyx_v_5pysam_9csamtools_CODE2CIGAR;
-static char *__pyx_v_5pysam_9csamtools_bam_nt16_rev_table;
-static int __pyx_v_5pysam_9csamtools_max_pos;
-static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *, size_t); /*proto*/
-static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *); /*proto*/
-static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *); /*proto*/
-static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools__force_cmdline_bytes(PyObject *); /*proto*/
-static PyObject *__pyx_f_5pysam_9csamtools__charptr_to_str(char *); /*proto*/
-static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *); /*proto*/
-static PyObject *__pyx_f_5pysam_9csamtools_makeAlignedRead(bam1_t *); /*proto*/
-static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **, int, int, int); /*proto*/
-static PyObject *__pyx_f_5pysam_9csamtools_makePileupRead(bam_pileup1_t *); /*proto*/
-static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *); /*proto*/
-static int __pyx_f_5pysam_9csamtools_fetch_callback(bam1_t *, void *); /*proto*/
-static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t, uint32_t, int, bam_pileup1_t *, void *); /*proto*/
-static int __pyx_f_5pysam_9csamtools_pileup_fetch_callback(bam1_t *, void *); /*proto*/
-static int __pyx_f_5pysam_9csamtools_count_callback(bam1_t *, void *); /*proto*/
-static int __pyx_f_5pysam_9csamtools_mate_callback(bam1_t *, void *); /*proto*/
-static int __pyx_f_5pysam_9csamtools___advance_all(void *, bam1_t *); /*proto*/
-static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *, bam1_t *); /*proto*/
-static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *); /*proto*/
-static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *); /*proto*/
-static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *, uint32_t, uint32_t); /*proto*/
-static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *, uint32_t, uint32_t); /*proto*/
-#define __Pyx_MODULE_NAME "pysam.csamtools"
-int __pyx_module_is_main_pysam__csamtools = 0;
-
-/* Implementation of 'pysam.csamtools' */
+/* Module declarations from 'csamtools' */
+static PyTypeObject *__pyx_ptype_9csamtools_Fastafile = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_AlignedRead = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_Samfile = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_PileupProxy = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_PileupRead = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_IteratorRow = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowRegion = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAll = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAllRefs = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowSelection = 0;
+static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumn = 0;
+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;
+static char *__pyx_v_9csamtools_CODE2CIGAR;
+static char *__pyx_v_9csamtools_bam_nt16_rev_table;
+static int __pyx_v_9csamtools_max_pos;
+static PyObject *__pyx_f_9csamtools_from_string_and_size(char *, size_t); /*proto*/
+static PyObject *__pyx_f_9csamtools__my_encodeFilename(PyObject *); /*proto*/
+static PyObject *__pyx_f_9csamtools__force_bytes(PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_9csamtools__force_cmdline_bytes(PyObject *); /*proto*/
+static PyObject *__pyx_f_9csamtools__charptr_to_str(char *); /*proto*/
+static PyObject *__pyx_f_9csamtools__force_str(PyObject *); /*proto*/
+static PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *); /*proto*/
+static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t **, int, int, int); /*proto*/
+static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *); /*proto*/
+static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *); /*proto*/
+static int __pyx_f_9csamtools_fetch_callback(bam1_t *, void *); /*proto*/
+static int __pyx_f_9csamtools_pileup_callback(uint32_t, uint32_t, int, bam_pileup1_t *, void *); /*proto*/
+static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *, void *); /*proto*/
+static int __pyx_f_9csamtools_count_callback(bam1_t *, void *); /*proto*/
+static int __pyx_f_9csamtools_mate_callback(bam1_t *, void *); /*proto*/
+static int __pyx_f_9csamtools___advance_all(void *, bam1_t *); /*proto*/
+static int __pyx_f_9csamtools___advance_snpcalls(void *, bam1_t *); /*proto*/
+static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *); /*proto*/
+static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *, uint32_t, uint32_t); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *, uint32_t, uint32_t); /*proto*/
+#define __Pyx_MODULE_NAME "csamtools"
+int __pyx_module_is_main_csamtools = 0;
+
+/* Implementation of 'csamtools' */
 static PyObject *__pyx_builtin_object;
 static PyObject *__pyx_builtin_TypeError;
 static PyObject *__pyx_builtin_enumerate;
@@ -1513,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_5pysam_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_18StderrStoreWindows___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_18StderrStoreWindows_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_18StderrStoreWindows_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_9Fastafile___cinit__(struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static Py_ssize_t __pyx_pf_5pysam_9csamtools_9Fastafile_4__len__(struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_6_open(struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8close(struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static void __pyx_pf_5pysam_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8filename___get__(struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_5pysam_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_5pysam_9csamtools_7Samfile___cinit__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, struct __pyx_obj_5pysam_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_5pysam_9csamtools_7Samfile_8gettid(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_5pysam_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_5pysam_9csamtools_7Samfile_14reset(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, uint64_t __pyx_v_offset, int __pyx_v_where); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5pysam_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_5pysam_9csamtools_7Samfile_22mate(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_read); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5pysam_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_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5pysam_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_5pysam_9csamtools_7Samfile_28close(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static void __pyx_pf_5pysam_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_32write(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_read); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_34__enter__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_36__exit__(struct __pyx_obj_5pysam_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_5pysam_9csamtools_7Samfile_8filename___get__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_11nreferences___get__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10references___get__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4text___get__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_fields, PyObject *__pyx_v_record); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_42__next__(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *__pyx_v_self, struct __pyx_obj_5pysam_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_5pysam_9csamtools_17IteratorRowRegion_2__iter__(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
-static void __pyx_pf_5pysam_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_2__iter__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
-static void __pyx_pf_5pysam_9csamtools_14IteratorRowAll_6__dealloc__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_4__iter__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_positions, int __pyx_v_reopen); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_2__iter__(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_4__next__(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
-static void __pyx_pf_5pysam_9csamtools_20IteratorRowSelection_6__dealloc__(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_2__iter__(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_7seq_len___get__(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_4addReference(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_fastafile); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_6hasReference(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
-static void __pyx_pf_5pysam_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_5pysam_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_5pysam_9csamtools_20IteratorColumnRegion_2__next__(struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead___init__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static void __pyx_pf_5pysam_9csamtools_11AlignedRead_2__dealloc__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_other); /* proto */
-static Py_hash_t __pyx_pf_5pysam_9csamtools_11AlignedRead_8__hash__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5qname___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qname); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_values); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_cigar); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_seq); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qual___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5query___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qend___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tags); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4flag___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rname___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3tid___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3pos___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_pos); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3bin___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_bin); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4rlen___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4aend___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4alen___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5isize___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10is_reverse___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get__(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, uint32_t __pyx_v_start, uint32_t __pyx_v_end); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tag); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_5pysam_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3tid___get__(struct __pyx_obj_5pysam_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_1n___get__(struct __pyx_obj_5pysam_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj_5pysam_9csamtools_PileupProxy *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3pos___get__(struct __pyx_obj_5pysam_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_7pileups___get__(struct __pyx_obj_5pysam_9csamtools_PileupProxy *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_9alignment___get__(struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5indel___get__(struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_6is_del___get__(struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_head___get__(struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5level___get__(struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_4Outs___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_id); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fd); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_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_5pysam_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3pos___get__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_14reference_base___get__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8genotype___get__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_17consensus_quality___get__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_11snp_quality___get__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_15mapping_quality___get__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8coverage___get__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall___str__(struct __pyx_obj_5pysam_9csamtools_SNPCall *__pyx_v_self); /* proto */
-static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5pysam_9csamtools_IndexedReads *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_obj_5pysam_9csamtools_IndexedReads *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_obj_5pysam_9csamtools_IndexedReads *__pyx_v_self, PyObject *__pyx_v_qname); /* proto */
-static void __pyx_pf_5pysam_9csamtools_12IndexedReads_6__dealloc__(struct __pyx_obj_5pysam_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";
@@ -1755,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";
@@ -1887,12 +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[] = "pysam.csamtools";
-static char __pyx_k_258[] = "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_267[] = "\n    stderr is captured.\n    ";
-static char __pyx_k_274[] = "does nothing. stderr can't be redirected on windows";
-static char __pyx_k_291[] = "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";
@@ -1935,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";
@@ -1984,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";
@@ -2022,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";
@@ -2072,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";
@@ -2085,6 +1770,7 @@ static char __pyx_k__TypeError[] = "TypeError";
 static char __pyx_k____enter__[] = "__enter__";
 static char __pyx_k___hasIndex[] = "_hasIndex";
 static char __pyx_k__alignment[] = "alignment";
+static char __pyx_k__csamtools[] = "csamtools";
 static char __pyx_k__enumerate[] = "enumerate";
 static char __pyx_k__exc_value[] = "exc_value";
 static char __pyx_k__fastafile[] = "fastafile";
@@ -2102,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";
@@ -2116,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";
@@ -2209,13 +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_n_s_257;
-static PyObject *__pyx_kp_s_258;
-static PyObject *__pyx_kp_s_267;
-static PyObject *__pyx_kp_s_274;
+static PyObject *__pyx_kp_s_262;
 static PyObject *__pyx_kp_s_29;
-static PyObject *__pyx_kp_s_291;
 static PyObject *__pyx_kp_u_3;
 static PyObject *__pyx_kp_s_30;
 static PyObject *__pyx_kp_s_31;
@@ -2344,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;
@@ -2357,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;
@@ -2368,6 +2047,7 @@ static PyObject *__pyx_n_s__collections;
 static PyObject *__pyx_n_s__compile;
 static PyObject *__pyx_n_s__consensus_quality;
 static PyObject *__pyx_n_s__coverage;
+static PyObject *__pyx_n_s__csamtools;
 static PyObject *__pyx_n_s__ctypes;
 static PyObject *__pyx_n_s__d;
 static PyObject *__pyx_n_s__data_len;
@@ -2400,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;
@@ -2434,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;
@@ -2473,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;
@@ -2491,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;
@@ -2629,43 +2299,14 @@ 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_261;
-static PyObject *__pyx_k_tuple_263;
-static PyObject *__pyx_k_tuple_265;
-static PyObject *__pyx_k_tuple_268;
-static PyObject *__pyx_k_tuple_270;
-static PyObject *__pyx_k_tuple_272;
-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_280;
-static PyObject *__pyx_k_tuple_282;
-static PyObject *__pyx_k_tuple_283;
-static PyObject *__pyx_k_tuple_285;
-static PyObject *__pyx_k_tuple_287;
-static PyObject *__pyx_k_tuple_289;
-static PyObject *__pyx_k_tuple_292;
-static PyObject *__pyx_k_codeobj_255;
-static PyObject *__pyx_k_codeobj_260;
-static PyObject *__pyx_k_codeobj_262;
-static PyObject *__pyx_k_codeobj_264;
-static PyObject *__pyx_k_codeobj_266;
-static PyObject *__pyx_k_codeobj_269;
-static PyObject *__pyx_k_codeobj_271;
-static PyObject *__pyx_k_codeobj_273;
-static PyObject *__pyx_k_codeobj_281;
-static PyObject *__pyx_k_codeobj_284;
-static PyObject *__pyx_k_codeobj_286;
-static PyObject *__pyx_k_codeobj_288;
-static PyObject *__pyx_k_codeobj_290;
-static PyObject *__pyx_k_codeobj_293;
-static PyObject *__pyx_gb_5pysam_9csamtools_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-
-/* "pysam/csamtools.pyx":140
+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"
  * if IS_PYTHON3:
  *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )             # <<<<<<<<<<<<<<
@@ -2673,35 +2314,29 @@ static PyObject *__pyx_gb_5pysam_9csamtools_4generator(__pyx_GeneratorObject *__
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__pyx_self) {
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *__pyx_cur_scope;
+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_cur_scope = (struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *)__pyx_ptype_5pysam_9csamtools___pyx_scope_struct__genexpr->tp_new(__pyx_ptype_5pysam_9csamtools___pyx_scope_struct__genexpr, __pyx_empty_tuple, NULL);
+  __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();
     return NULL;
   }
   __Pyx_GOTREF(__pyx_cur_scope);
   __Pyx_TraceCall("genexpr", __pyx_f[0], 140);
-  {
-    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_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("pysam.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);
@@ -2709,17 +2344,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__p
   return __pyx_r;
 }
 
-static PyObject *__pyx_gb_5pysam_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_5pysam_9csamtools___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_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 */
@@ -2730,7 +2364,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_4generator(__pyx_GeneratorObject *__
   if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_INCREF(__pyx_int_0);
   __pyx_t_1 = __pyx_int_0;
-  __pyx_t_2 = PyBytes_FromString(__pyx_v_5pysam_9csamtools_CODE2CIGAR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(__pyx_v_9csamtools_CODE2CIGAR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -2764,7 +2398,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_4generator(__pyx_GeneratorObject *__
     __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);
@@ -2781,7 +2415,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_4generator(__pyx_GeneratorObject *__
     __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;
@@ -2795,7 +2429,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_4generator(__pyx_GeneratorObject *__
   }
   __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);
@@ -2804,14 +2438,13 @@ static PyObject *__pyx_gb_5pysam_9csamtools_4generator(__pyx_GeneratorObject *__
   __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_r);
-  __pyx_generator->resume_label = -1;
-  __Pyx_Generator_clear((PyObject*)__pyx_generator);
+  __pyx_cur_scope->__pyx_base.resume_label = -1;
   __Pyx_RefNannyFinishContext();
   return NULL;
 }
-static PyObject *__pyx_gb_5pysam_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 */
 
-/* "pysam/csamtools.pyx":142
+/* "csamtools.pyx":142
  *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
  * else:
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )             # <<<<<<<<<<<<<<
@@ -2819,35 +2452,29 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__pyx_self) {
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
+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_cur_scope = (struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *)__pyx_ptype_5pysam_9csamtools___pyx_scope_struct_1_genexpr->tp_new(__pyx_ptype_5pysam_9csamtools___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
+  __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();
     return NULL;
   }
   __Pyx_GOTREF(__pyx_cur_scope);
   __Pyx_TraceCall("genexpr", __pyx_f[0], 142);
-  {
-    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5pysam_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("pysam.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);
@@ -2855,9 +2482,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__p
   return __pyx_r;
 }
 
-static PyObject *__pyx_gb_5pysam_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_5pysam_9csamtools___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
   PyObject *__pyx_r = NULL;
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
@@ -2865,8 +2491,8 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
   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 */
@@ -2877,7 +2503,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
   if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_INCREF(__pyx_int_0);
   __pyx_t_1 = __pyx_int_0;
-  __pyx_t_2 = PyBytes_FromString(__pyx_v_5pysam_9csamtools_CODE2CIGAR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_FromString(__pyx_v_9csamtools_CODE2CIGAR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -2911,7 +2537,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
     __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);
@@ -2919,7 +2545,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
     __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);
@@ -2936,7 +2562,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
     __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;
@@ -2950,7 +2576,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
   }
   __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);
@@ -2960,13 +2586,12 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
   __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_r);
-  __pyx_generator->resume_label = -1;
-  __Pyx_Generator_clear((PyObject*)__pyx_generator);
+  __pyx_cur_scope->__pyx_base.resume_label = -1;
   __Pyx_RefNannyFinishContext();
   return NULL;
 }
 
-/* "pysam/csamtools.pyx":24
+/* "csamtools.pyx":24
  * ########################################################################
  * IS_PYTHON3 = PY_MAJOR_VERSION >= 3
  * cdef from_string_and_size(char* s, size_t length):             # <<<<<<<<<<<<<<
@@ -2974,7 +2599,7 @@ static PyObject *__pyx_gb_5pysam_9csamtools_7generator1(__pyx_GeneratorObject *_
  *         return s[:length]
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s, size_t __pyx_v_length) {
+static PyObject *__pyx_f_9csamtools_from_string_and_size(char *__pyx_v_s, size_t __pyx_v_length) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -2983,10 +2608,10 @@ static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s,
   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);
 
-  /* "pysam/csamtools.pyx":25
+  /* "csamtools.pyx":25
  * IS_PYTHON3 = PY_MAJOR_VERSION >= 3
  * cdef from_string_and_size(char* s, size_t length):
  *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
@@ -2996,7 +2621,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s,
   __pyx_t_1 = (PY_MAJOR_VERSION < 3);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":26
+    /* "csamtools.pyx":26
  * cdef from_string_and_size(char* s, size_t length):
  *     if PY_MAJOR_VERSION < 3:
  *         return s[:length]             # <<<<<<<<<<<<<<
@@ -3004,7 +2629,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s,
  *         return s[:length].decode("ascii")
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyBytes_FromStringAndSize(((const char*)__pyx_v_s) + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -3013,7 +2638,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s,
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":28
+    /* "csamtools.pyx":28
  *         return s[:length]
  *     else:
  *         return s[:length].decode("ascii")             # <<<<<<<<<<<<<<
@@ -3021,7 +2646,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s,
  * # filename encoding (copied from lxml.etree.pyx)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_length, NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = ((PyObject *)PyUnicode_DecodeASCII(__pyx_v_s, __pyx_v_length, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -3033,7 +2658,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s,
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.from_string_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.from_string_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3042,7 +2667,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s,
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":41
+/* "csamtools.pyx":41
  * #_C_FILENAME_ENCODING = <char*>_FILENAME_ENCODING
  * 
  * cdef bytes _my_encodeFilename(object filename):             # <<<<<<<<<<<<<<
@@ -3050,7 +2675,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_from_string_and_size(char *__pyx_v_s,
  *     """
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_filename) {
+static PyObject *__pyx_f_9csamtools__my_encodeFilename(PyObject *__pyx_v_filename) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -3061,10 +2686,10 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
   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);
 
-  /* "pysam/csamtools.pyx":44
+  /* "csamtools.pyx":44
  *     u"""Make sure a filename is 8-bit encoded (or None).
  *     """
  *     if filename is None:             # <<<<<<<<<<<<<<
@@ -3074,7 +2699,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
   __pyx_t_1 = (__pyx_v_filename == Py_None);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":45
+    /* "csamtools.pyx":45
  *     """
  *     if filename is None:
  *         return None             # <<<<<<<<<<<<<<
@@ -3088,7 +2713,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":46
+  /* "csamtools.pyx":46
  *     if filename is None:
  *         return None
  *     elif PyBytes_Check(filename):             # <<<<<<<<<<<<<<
@@ -3098,7 +2723,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
   __pyx_t_1 = PyBytes_Check(__pyx_v_filename);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":47
+    /* "csamtools.pyx":47
  *         return None
  *     elif PyBytes_Check(filename):
  *         return filename             # <<<<<<<<<<<<<<
@@ -3113,7 +2738,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":48
+  /* "csamtools.pyx":48
  *     elif PyBytes_Check(filename):
  *         return filename
  *     elif PyUnicode_Check(filename):             # <<<<<<<<<<<<<<
@@ -3123,7 +2748,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
   __pyx_t_1 = PyUnicode_Check(__pyx_v_filename);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":49
+    /* "csamtools.pyx":49
  *         return filename
  *     elif PyUnicode_Check(filename):
  *         return filename.encode(_FILENAME_ENCODING)             # <<<<<<<<<<<<<<
@@ -3134,10 +2759,10 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
     __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_INCREF(((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
-    __Pyx_GIVEREF(((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
+    __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));
     __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -3150,7 +2775,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":51
+    /* "csamtools.pyx":51
  *         return filename.encode(_FILENAME_ENCODING)
  *     else:
  *         raise TypeError, u"Argument must be string or unicode."             # <<<<<<<<<<<<<<
@@ -3168,7 +2793,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools._my_encodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools._my_encodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3177,7 +2802,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":54
+/* "csamtools.pyx":54
  * 
  * 
  * cdef bytes _force_bytes(object s):             # <<<<<<<<<<<<<<
@@ -3185,7 +2810,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__my_encodeFilename(PyObject *__pyx_v_
  *     """
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
+static PyObject *__pyx_f_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -3195,10 +2820,10 @@ static PyObject *__pyx_f_5pysam_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);
 
-  /* "pysam/csamtools.pyx":57
+  /* "csamtools.pyx":57
  *     u"""convert string or unicode object to bytes, assuming ascii encoding.
  *     """
  *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
@@ -3208,7 +2833,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   __pyx_t_1 = (PY_MAJOR_VERSION < 3);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":58
+    /* "csamtools.pyx":58
  *     """
  *     if PY_MAJOR_VERSION < 3:
  *         return s             # <<<<<<<<<<<<<<
@@ -3223,7 +2848,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":59
+  /* "csamtools.pyx":59
  *     if PY_MAJOR_VERSION < 3:
  *         return s
  *     elif s is None:             # <<<<<<<<<<<<<<
@@ -3233,7 +2858,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   __pyx_t_1 = (__pyx_v_s == Py_None);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":60
+    /* "csamtools.pyx":60
  *         return s
  *     elif s is None:
  *         return None             # <<<<<<<<<<<<<<
@@ -3247,7 +2872,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":61
+  /* "csamtools.pyx":61
  *     elif s is None:
  *         return None
  *     elif PyBytes_Check(s):             # <<<<<<<<<<<<<<
@@ -3257,7 +2882,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   __pyx_t_1 = PyBytes_Check(__pyx_v_s);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":62
+    /* "csamtools.pyx":62
  *         return None
  *     elif PyBytes_Check(s):
  *         return s             # <<<<<<<<<<<<<<
@@ -3272,7 +2897,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":63
+  /* "csamtools.pyx":63
  *     elif PyBytes_Check(s):
  *         return s
  *     elif PyUnicode_Check(s):             # <<<<<<<<<<<<<<
@@ -3282,7 +2907,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   __pyx_t_1 = PyUnicode_Check(__pyx_v_s);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":64
+    /* "csamtools.pyx":64
  *         return s
  *     elif PyUnicode_Check(s):
  *         return s.encode('ascii')             # <<<<<<<<<<<<<<
@@ -3303,7 +2928,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":66
+    /* "csamtools.pyx":66
  *         return s.encode('ascii')
  *     else:
  *         raise TypeError, u"Argument must be string, bytes or unicode."             # <<<<<<<<<<<<<<
@@ -3320,7 +2945,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools._force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools._force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3329,7 +2954,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":68
+/* "csamtools.pyx":68
  *         raise TypeError, u"Argument must be string, bytes or unicode."
  * 
  * cdef inline bytes _force_cmdline_bytes(object s):             # <<<<<<<<<<<<<<
@@ -3337,7 +2962,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_bytes(PyObject *__pyx_v_s) {
  * 
  */
 
-static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools__force_cmdline_bytes(PyObject *__pyx_v_s) {
+static CYTHON_INLINE PyObject *__pyx_f_9csamtools__force_cmdline_bytes(PyObject *__pyx_v_s) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3345,10 +2970,10 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools__force_cmdline_bytes(Py
   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);
 
-  /* "pysam/csamtools.pyx":69
+  /* "csamtools.pyx":69
  * 
  * cdef inline bytes _force_cmdline_bytes(object s):
  *     return _force_bytes(s)             # <<<<<<<<<<<<<<
@@ -3356,7 +2981,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools__force_cmdline_bytes(Py
  * cdef _charptr_to_str(char* s):
  */
   __Pyx_XDECREF(((PyObject *)__pyx_r));
-  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_bytes(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -3366,7 +2991,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools__force_cmdline_bytes(Py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools._force_cmdline_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools._force_cmdline_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3375,7 +3000,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools__force_cmdline_bytes(Py
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":71
+/* "csamtools.pyx":71
  *     return _force_bytes(s)
  * 
  * cdef _charptr_to_str(char* s):             # <<<<<<<<<<<<<<
@@ -3383,7 +3008,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools__force_cmdline_bytes(Py
  *         return s
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools__charptr_to_str(char *__pyx_v_s) {
+static PyObject *__pyx_f_9csamtools__charptr_to_str(char *__pyx_v_s) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -3392,10 +3017,10 @@ static PyObject *__pyx_f_5pysam_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);
 
-  /* "pysam/csamtools.pyx":72
+  /* "csamtools.pyx":72
  * 
  * cdef _charptr_to_str(char* s):
  *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
@@ -3405,7 +3030,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__charptr_to_str(char *__pyx_v_s) {
   __pyx_t_1 = (PY_MAJOR_VERSION < 3);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":73
+    /* "csamtools.pyx":73
  * cdef _charptr_to_str(char* s):
  *     if PY_MAJOR_VERSION < 3:
  *         return s             # <<<<<<<<<<<<<<
@@ -3422,7 +3047,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__charptr_to_str(char *__pyx_v_s) {
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":75
+    /* "csamtools.pyx":75
  *         return s
  *     else:
  *         return s.decode("ascii")             # <<<<<<<<<<<<<<
@@ -3430,7 +3055,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__charptr_to_str(char *__pyx_v_s) {
  * cdef _force_str(object s):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = ((PyObject *)PyUnicode_DecodeASCII(__pyx_v_s, strlen(__pyx_v_s), NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -3442,7 +3067,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__charptr_to_str(char *__pyx_v_s) {
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools._charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools._charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3451,7 +3076,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__charptr_to_str(char *__pyx_v_s) {
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":77
+/* "csamtools.pyx":77
  *         return s.decode("ascii")
  * 
  * cdef _force_str(object s):             # <<<<<<<<<<<<<<
@@ -3459,7 +3084,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__charptr_to_str(char *__pyx_v_s) {
  *     if s is None:
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
+static PyObject *__pyx_f_9csamtools__force_str(PyObject *__pyx_v_s) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -3469,10 +3094,10 @@ static PyObject *__pyx_f_5pysam_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);
 
-  /* "pysam/csamtools.pyx":79
+  /* "csamtools.pyx":79
  * cdef _force_str(object s):
  *     """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
  *     if s is None:             # <<<<<<<<<<<<<<
@@ -3482,7 +3107,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
   __pyx_t_1 = (__pyx_v_s == Py_None);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":80
+    /* "csamtools.pyx":80
  *     """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
  *     if s is None:
  *         return None             # <<<<<<<<<<<<<<
@@ -3497,7 +3122,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":81
+  /* "csamtools.pyx":81
  *     if s is None:
  *         return None
  *     if PY_MAJOR_VERSION < 3:             # <<<<<<<<<<<<<<
@@ -3507,7 +3132,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
   __pyx_t_1 = (PY_MAJOR_VERSION < 3);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":82
+    /* "csamtools.pyx":82
  *         return None
  *     if PY_MAJOR_VERSION < 3:
  *         return s             # <<<<<<<<<<<<<<
@@ -3521,7 +3146,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
     goto __pyx_L4;
   }
 
-  /* "pysam/csamtools.pyx":83
+  /* "csamtools.pyx":83
  *     if PY_MAJOR_VERSION < 3:
  *         return s
  *     elif PyBytes_Check(s):             # <<<<<<<<<<<<<<
@@ -3531,7 +3156,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
   __pyx_t_1 = PyBytes_Check(__pyx_v_s);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":84
+    /* "csamtools.pyx":84
  *         return s
  *     elif PyBytes_Check(s):
  *         return s.decode('ascii')             # <<<<<<<<<<<<<<
@@ -3551,7 +3176,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":87
+    /* "csamtools.pyx":87
  *     else:
  *         # assume unicode
  *         return s             # <<<<<<<<<<<<<<
@@ -3570,7 +3195,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools._force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools._force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -3579,7 +3204,7 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":160
+/* "csamtools.pyx":160
  * #####################################################################
  * cdef class AlignedRead
  * cdef makeAlignedRead(bam1_t * src):             # <<<<<<<<<<<<<<
@@ -3587,8 +3212,8 @@ static PyObject *__pyx_f_5pysam_9csamtools__force_str(PyObject *__pyx_v_s) {
  *     cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
-  struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_dest = 0;
+static PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
+  struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_dest = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3596,23 +3221,23 @@ static PyObject *__pyx_f_5pysam_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);
 
-  /* "pysam/csamtools.pyx":162
+  /* "csamtools.pyx":162
  * cdef makeAlignedRead(bam1_t * src):
  *     '''enter src into AlignedRead.'''
  *     cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)             # <<<<<<<<<<<<<<
  *     dest._delegate = bam_dup1(src)
  *     return dest
  */
-  __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5pysam_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5pysam_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_dest = ((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_t_1);
+  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":163
+  /* "csamtools.pyx":163
  *     '''enter src into AlignedRead.'''
  *     cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  *     dest._delegate = bam_dup1(src)             # <<<<<<<<<<<<<<
@@ -3621,7 +3246,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src)
  */
   __pyx_v_dest->_delegate = bam_dup1(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":164
+  /* "csamtools.pyx":164
  *     cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  *     dest._delegate = bam_dup1(src)
  *     return dest             # <<<<<<<<<<<<<<
@@ -3637,7 +3262,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src)
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.makeAlignedRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.makeAlignedRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_dest);
@@ -3647,7 +3272,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src)
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":167
+/* "csamtools.pyx":167
  * 
  * cdef class PileupProxy
  * cdef makePileupProxy( bam_pileup1_t ** plp, int tid, int pos, int n ):             # <<<<<<<<<<<<<<
@@ -3655,8 +3280,8 @@ static PyObject *__pyx_f_5pysam_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src)
  *      dest.plp = plp
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx_v_plp, int __pyx_v_tid, int __pyx_v_pos, int __pyx_v_n) {
-  struct __pyx_obj_5pysam_9csamtools_PileupProxy *__pyx_v_dest = 0;
+static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t **__pyx_v_plp, int __pyx_v_tid, int __pyx_v_pos, int __pyx_v_n) {
+  struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_dest = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3664,23 +3289,23 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx
   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);
 
-  /* "pysam/csamtools.pyx":168
+  /* "csamtools.pyx":168
  * cdef class PileupProxy
  * cdef makePileupProxy( bam_pileup1_t ** plp, int tid, int pos, int n ):
  *      cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)             # <<<<<<<<<<<<<<
  *      dest.plp = plp
  *      dest.tid = tid
  */
-  __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5pysam_9csamtools_PileupProxy)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_PileupProxy)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5pysam_9csamtools_PileupProxy)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_dest = ((struct __pyx_obj_5pysam_9csamtools_PileupProxy *)__pyx_t_1);
+  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_PileupProxy)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":169
+  /* "csamtools.pyx":169
  * cdef makePileupProxy( bam_pileup1_t ** plp, int tid, int pos, int n ):
  *      cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
  *      dest.plp = plp             # <<<<<<<<<<<<<<
@@ -3689,7 +3314,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx
  */
   __pyx_v_dest->plp = __pyx_v_plp;
 
-  /* "pysam/csamtools.pyx":170
+  /* "csamtools.pyx":170
  *      cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
  *      dest.plp = plp
  *      dest.tid = tid             # <<<<<<<<<<<<<<
@@ -3698,7 +3323,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx
  */
   __pyx_v_dest->tid = __pyx_v_tid;
 
-  /* "pysam/csamtools.pyx":171
+  /* "csamtools.pyx":171
  *      dest.plp = plp
  *      dest.tid = tid
  *      dest.pos = pos             # <<<<<<<<<<<<<<
@@ -3707,7 +3332,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx
  */
   __pyx_v_dest->pos = __pyx_v_pos;
 
-  /* "pysam/csamtools.pyx":172
+  /* "csamtools.pyx":172
  *      dest.tid = tid
  *      dest.pos = pos
  *      dest.n = n             # <<<<<<<<<<<<<<
@@ -3719,7 +3344,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx
   if (PyObject_SetAttr(((PyObject *)__pyx_v_dest), __pyx_n_s__n, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":173
+  /* "csamtools.pyx":173
  *      dest.pos = pos
  *      dest.n = n
  *      return dest             # <<<<<<<<<<<<<<
@@ -3735,7 +3360,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.makePileupProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.makePileupProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_dest);
@@ -3745,7 +3370,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":176
+/* "csamtools.pyx":176
  * 
  * cdef class PileupRead
  * cdef makePileupRead( bam_pileup1_t * src ):             # <<<<<<<<<<<<<<
@@ -3753,111 +3378,102 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupProxy(bam_pileup1_t **__pyx
  *     cdef PileupRead dest = PileupRead.__new__(PileupRead)
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src) {
-  struct __pyx_obj_5pysam_9csamtools_PileupRead *__pyx_v_dest = 0;
+static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src) {
+  struct __pyx_obj_9csamtools_PileupRead *__pyx_v_dest = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  int32_t __pyx_t_2;
-  int __pyx_t_3;
-  uint32_t __pyx_t_4;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":178
+  /* "csamtools.pyx":178
  * cdef makePileupRead( bam_pileup1_t * src ):
  *     '''fill a  PileupRead object from a bam_pileup1_t * object.'''
  *     cdef PileupRead dest = PileupRead.__new__(PileupRead)             # <<<<<<<<<<<<<<
  *     dest._alignment = makeAlignedRead( src.b )
  *     dest._qpos = src.qpos
  */
-  __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5pysam_9csamtools_PileupRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_PileupRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5pysam_9csamtools_PileupRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_dest = ((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_t_1);
+  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_PileupRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupRead *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":179
+  /* "csamtools.pyx":179
  *     '''fill a  PileupRead object from a bam_pileup1_t * object.'''
  *     cdef PileupRead dest = PileupRead.__new__(PileupRead)
  *     dest._alignment = makeAlignedRead( src.b )             # <<<<<<<<<<<<<<
  *     dest._qpos = src.qpos
  *     dest._indel = src.indel
  */
-  __pyx_t_1 = __pyx_f_5pysam_9csamtools_makeAlignedRead(__pyx_v_src->b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_src->b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5pysam_9csamtools_AlignedRead))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_AlignedRead))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_GOTREF(__pyx_v_dest->_alignment);
   __Pyx_DECREF(((PyObject *)__pyx_v_dest->_alignment));
-  __pyx_v_dest->_alignment = ((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_t_1);
+  __pyx_v_dest->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":180
+  /* "csamtools.pyx":180
  *     cdef PileupRead dest = PileupRead.__new__(PileupRead)
  *     dest._alignment = makeAlignedRead( src.b )
  *     dest._qpos = src.qpos             # <<<<<<<<<<<<<<
  *     dest._indel = src.indel
  *     dest._level = src.level
  */
-  __pyx_t_2 = __pyx_v_src->qpos;
-  __pyx_v_dest->_qpos = __pyx_t_2;
+  __pyx_v_dest->_qpos = __pyx_v_src->qpos;
 
-  /* "pysam/csamtools.pyx":181
+  /* "csamtools.pyx":181
  *     dest._alignment = makeAlignedRead( src.b )
  *     dest._qpos = src.qpos
  *     dest._indel = src.indel             # <<<<<<<<<<<<<<
  *     dest._level = src.level
  *     dest._is_del = src.is_del
  */
-  __pyx_t_3 = __pyx_v_src->indel;
-  __pyx_v_dest->_indel = __pyx_t_3;
+  __pyx_v_dest->_indel = __pyx_v_src->indel;
 
-  /* "pysam/csamtools.pyx":182
+  /* "csamtools.pyx":182
  *     dest._qpos = src.qpos
  *     dest._indel = src.indel
  *     dest._level = src.level             # <<<<<<<<<<<<<<
  *     dest._is_del = src.is_del
  *     dest._is_head = src.is_head
  */
-  __pyx_t_3 = __pyx_v_src->level;
-  __pyx_v_dest->_level = __pyx_t_3;
+  __pyx_v_dest->_level = __pyx_v_src->level;
 
-  /* "pysam/csamtools.pyx":183
+  /* "csamtools.pyx":183
  *     dest._indel = src.indel
  *     dest._level = src.level
  *     dest._is_del = src.is_del             # <<<<<<<<<<<<<<
  *     dest._is_head = src.is_head
  *     dest._is_tail = src.is_tail
  */
-  __pyx_t_4 = __pyx_v_src->is_del;
-  __pyx_v_dest->_is_del = __pyx_t_4;
+  __pyx_v_dest->_is_del = __pyx_v_src->is_del;
 
-  /* "pysam/csamtools.pyx":184
+  /* "csamtools.pyx":184
  *     dest._level = src.level
  *     dest._is_del = src.is_del
  *     dest._is_head = src.is_head             # <<<<<<<<<<<<<<
  *     dest._is_tail = src.is_tail
  *     return dest
  */
-  __pyx_t_4 = __pyx_v_src->is_head;
-  __pyx_v_dest->_is_head = __pyx_t_4;
+  __pyx_v_dest->_is_head = __pyx_v_src->is_head;
 
-  /* "pysam/csamtools.pyx":185
+  /* "csamtools.pyx":185
  *     dest._is_del = src.is_del
  *     dest._is_head = src.is_head
  *     dest._is_tail = src.is_tail             # <<<<<<<<<<<<<<
  *     return dest
  * 
  */
-  __pyx_t_4 = __pyx_v_src->is_tail;
-  __pyx_v_dest->_is_tail = __pyx_t_4;
+  __pyx_v_dest->_is_tail = __pyx_v_src->is_tail;
 
-  /* "pysam/csamtools.pyx":186
+  /* "csamtools.pyx":186
  *     dest._is_head = src.is_head
  *     dest._is_tail = src.is_tail
  *     return dest             # <<<<<<<<<<<<<<
@@ -3873,7 +3489,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.makePileupRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.makePileupRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_dest);
@@ -3883,7 +3499,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":188
+/* "csamtools.pyx":188
  *     return dest
  * 
  * cdef convertBinaryTagToList( uint8_t * s ):             # <<<<<<<<<<<<<<
@@ -3891,12 +3507,12 @@ static PyObject *__pyx_f_5pysam_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v
  *     cdef char auxtype
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
+static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
   char __pyx_v_auxtype;
   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;
@@ -3909,10 +3525,10 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   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);
 
-  /* "pysam/csamtools.pyx":195
+  /* "csamtools.pyx":195
  * 
  *     # get byte size
  *     auxtype = s[0]             # <<<<<<<<<<<<<<
@@ -3921,7 +3537,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
  */
   __pyx_v_auxtype = (__pyx_v_s[0]);
 
-  /* "pysam/csamtools.pyx":196
+  /* "csamtools.pyx":196
  *     # get byte size
  *     auxtype = s[0]
  *     byte_size = bam_aux_type2size( auxtype )             # <<<<<<<<<<<<<<
@@ -3930,7 +3546,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
  */
   __pyx_v_byte_size = bam_aux_type2size(__pyx_v_auxtype);
 
-  /* "pysam/csamtools.pyx":197
+  /* "csamtools.pyx":197
  *     auxtype = s[0]
  *     byte_size = bam_aux_type2size( auxtype )
  *     s += 1             # <<<<<<<<<<<<<<
@@ -3939,7 +3555,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
  */
   __pyx_v_s = (__pyx_v_s + 1);
 
-  /* "pysam/csamtools.pyx":199
+  /* "csamtools.pyx":199
  *     s += 1
  *     # get number of values in array
  *     nvalues = (<int32_t*>s)[0]             # <<<<<<<<<<<<<<
@@ -3948,7 +3564,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
  */
   __pyx_v_nvalues = (((int32_t *)__pyx_v_s)[0]);
 
-  /* "pysam/csamtools.pyx":200
+  /* "csamtools.pyx":200
  *     # get number of values in array
  *     nvalues = (<int32_t*>s)[0]
  *     s += 4             # <<<<<<<<<<<<<<
@@ -3957,7 +3573,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
  */
   __pyx_v_s = (__pyx_v_s + 4);
 
-  /* "pysam/csamtools.pyx":202
+  /* "csamtools.pyx":202
  *     s += 4
  *     # get values
  *     values = []             # <<<<<<<<<<<<<<
@@ -3965,11 +3581,11 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
  *         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;
 
-  /* "pysam/csamtools.pyx":203
+  /* "csamtools.pyx":203
  *     # get values
  *     values = []
  *     if auxtype == 'c':             # <<<<<<<<<<<<<<
@@ -3979,7 +3595,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __pyx_t_2 = (__pyx_v_auxtype == 'c');
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":204
+    /* "csamtools.pyx":204
  *     values = []
  *     if auxtype == 'c':
  *         for x from 0 <= x < nvalues:             # <<<<<<<<<<<<<<
@@ -3989,19 +3605,22 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     __pyx_t_3 = __pyx_v_nvalues;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-      /* "pysam/csamtools.pyx":205
+      /* "csamtools.pyx":205
  *     if auxtype == 'c':
  *         for x from 0 <= x < nvalues:
  *             values.append((<int8_t*>s)[0])             # <<<<<<<<<<<<<<
  *             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;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":206
+      /* "csamtools.pyx":206
  *         for x from 0 <= x < nvalues:
  *             values.append((<int8_t*>s)[0])
  *             s += 1             # <<<<<<<<<<<<<<
@@ -4013,7 +3632,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":207
+  /* "csamtools.pyx":207
  *             values.append((<int8_t*>s)[0])
  *             s += 1
  *     elif auxtype == 'C':             # <<<<<<<<<<<<<<
@@ -4023,7 +3642,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __pyx_t_2 = (__pyx_v_auxtype == 'C');
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":208
+    /* "csamtools.pyx":208
  *             s += 1
  *     elif auxtype == 'C':
  *         for x from 0 <= x < nvalues:             # <<<<<<<<<<<<<<
@@ -4033,19 +3652,22 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     __pyx_t_3 = __pyx_v_nvalues;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-      /* "pysam/csamtools.pyx":209
+      /* "csamtools.pyx":209
  *     elif auxtype == 'C':
  *         for x from 0 <= x < nvalues:
  *             values.append((<uint8_t*>s)[0])             # <<<<<<<<<<<<<<
  *             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;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":210
+      /* "csamtools.pyx":210
  *         for x from 0 <= x < nvalues:
  *             values.append((<uint8_t*>s)[0])
  *             s += 1             # <<<<<<<<<<<<<<
@@ -4057,7 +3679,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":211
+  /* "csamtools.pyx":211
  *             values.append((<uint8_t*>s)[0])
  *             s += 1
  *     elif auxtype == 's':             # <<<<<<<<<<<<<<
@@ -4067,7 +3689,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __pyx_t_2 = (__pyx_v_auxtype == 's');
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":212
+    /* "csamtools.pyx":212
  *             s += 1
  *     elif auxtype == 's':
  *         for x from 0 <= x < nvalues:             # <<<<<<<<<<<<<<
@@ -4077,19 +3699,22 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     __pyx_t_3 = __pyx_v_nvalues;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-      /* "pysam/csamtools.pyx":213
+      /* "csamtools.pyx":213
  *     elif auxtype == 's':
  *         for x from 0 <= x < nvalues:
  *             values.append((<int16_t*>s)[0])             # <<<<<<<<<<<<<<
  *             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;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":214
+      /* "csamtools.pyx":214
  *         for x from 0 <= x < nvalues:
  *             values.append((<int16_t*>s)[0])
  *             s += 2             # <<<<<<<<<<<<<<
@@ -4101,7 +3726,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":215
+  /* "csamtools.pyx":215
  *             values.append((<int16_t*>s)[0])
  *             s += 2
  *     elif auxtype == 'S':             # <<<<<<<<<<<<<<
@@ -4111,7 +3736,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __pyx_t_2 = (__pyx_v_auxtype == 'S');
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":216
+    /* "csamtools.pyx":216
  *             s += 2
  *     elif auxtype == 'S':
  *         for x from 0 <= x < nvalues:             # <<<<<<<<<<<<<<
@@ -4121,19 +3746,22 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     __pyx_t_3 = __pyx_v_nvalues;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-      /* "pysam/csamtools.pyx":217
+      /* "csamtools.pyx":217
  *     elif auxtype == 'S':
  *         for x from 0 <= x < nvalues:
  *             values.append((<uint16_t*>s)[0])             # <<<<<<<<<<<<<<
  *             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;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":218
+      /* "csamtools.pyx":218
  *         for x from 0 <= x < nvalues:
  *             values.append((<uint16_t*>s)[0])
  *             s += 2             # <<<<<<<<<<<<<<
@@ -4145,7 +3773,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":219
+  /* "csamtools.pyx":219
  *             values.append((<uint16_t*>s)[0])
  *             s += 2
  *     elif auxtype == 'i':             # <<<<<<<<<<<<<<
@@ -4155,7 +3783,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __pyx_t_2 = (__pyx_v_auxtype == 'i');
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":220
+    /* "csamtools.pyx":220
  *             s += 2
  *     elif auxtype == 'i':
  *         for x from 0 <= x < nvalues:             # <<<<<<<<<<<<<<
@@ -4165,19 +3793,22 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     __pyx_t_3 = __pyx_v_nvalues;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-      /* "pysam/csamtools.pyx":221
+      /* "csamtools.pyx":221
  *     elif auxtype == 'i':
  *         for x from 0 <= x < nvalues:
  *             values.append((<int32_t*>s)[0])             # <<<<<<<<<<<<<<
  *             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;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":222
+      /* "csamtools.pyx":222
  *         for x from 0 <= x < nvalues:
  *             values.append((<int32_t*>s)[0])
  *             s += 4             # <<<<<<<<<<<<<<
@@ -4189,7 +3820,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":223
+  /* "csamtools.pyx":223
  *             values.append((<int32_t*>s)[0])
  *             s += 4
  *     elif auxtype == 'I':             # <<<<<<<<<<<<<<
@@ -4199,7 +3830,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __pyx_t_2 = (__pyx_v_auxtype == 'I');
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":224
+    /* "csamtools.pyx":224
  *             s += 4
  *     elif auxtype == 'I':
  *         for x from 0 <= x < nvalues:             # <<<<<<<<<<<<<<
@@ -4209,19 +3840,22 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     __pyx_t_3 = __pyx_v_nvalues;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-      /* "pysam/csamtools.pyx":225
+      /* "csamtools.pyx":225
  *     elif auxtype == 'I':
  *         for x from 0 <= x < nvalues:
  *             values.append((<uint32_t*>s)[0])             # <<<<<<<<<<<<<<
  *             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;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":226
+      /* "csamtools.pyx":226
  *         for x from 0 <= x < nvalues:
  *             values.append((<uint32_t*>s)[0])
  *             s += 4             # <<<<<<<<<<<<<<
@@ -4233,7 +3867,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     goto __pyx_L3;
   }
 
-  /* "pysam/csamtools.pyx":227
+  /* "csamtools.pyx":227
  *             values.append((<uint32_t*>s)[0])
  *             s += 4
  *     elif auxtype == 'f':             # <<<<<<<<<<<<<<
@@ -4243,7 +3877,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __pyx_t_2 = (__pyx_v_auxtype == 'f');
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":228
+    /* "csamtools.pyx":228
  *             s += 4
  *     elif auxtype == 'f':
  *         for x from 0 <= x < nvalues:             # <<<<<<<<<<<<<<
@@ -4253,19 +3887,22 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
     __pyx_t_3 = __pyx_v_nvalues;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-      /* "pysam/csamtools.pyx":229
+      /* "csamtools.pyx":229
  *     elif auxtype == 'f':
  *         for x from 0 <= x < nvalues:
  *             values.append((<float*>s)[0])             # <<<<<<<<<<<<<<
  *             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;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":230
+      /* "csamtools.pyx":230
  *         for x from 0 <= x < nvalues:
  *             values.append((<float*>s)[0])
  *             s += 4             # <<<<<<<<<<<<<<
@@ -4278,7 +3915,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":232
+  /* "csamtools.pyx":232
  *             s += 4
  * 
  *     return byte_size, nvalues, values             # <<<<<<<<<<<<<<
@@ -4291,7 +3928,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __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);
@@ -4311,7 +3948,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_AddTraceback("pysam.csamtools.convertBinaryTagToList", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.convertBinaryTagToList", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_values);
@@ -4321,7 +3958,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":239
+/* "csamtools.pyx":239
  * ## Generic callbacks for inserting python callbacks.
  * #####################################################################
  * cdef int fetch_callback( bam1_t *alignment, void *f):             # <<<<<<<<<<<<<<
@@ -4329,7 +3966,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_convertBinaryTagToList(uint8_t *__pyx
  * 
  */
 
-static int __pyx_f_5pysam_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
+static int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
   PyObject *__pyx_v_a = NULL;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
@@ -4339,22 +3976,22 @@ static int __pyx_f_5pysam_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, v
   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);
 
-  /* "pysam/csamtools.pyx":244
+  /* "csamtools.pyx":244
  *     calls function in *f* with a new :class:`AlignedRead` object as parameter.
  *     '''
  *     a = makeAlignedRead( alignment )             # <<<<<<<<<<<<<<
  *     (<object>f)(a)
  * 
  */
-  __pyx_t_1 = __pyx_f_5pysam_9csamtools_makeAlignedRead(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_v_a = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":245
+  /* "csamtools.pyx":245
  *     '''
  *     a = makeAlignedRead( alignment )
  *     (<object>f)(a)             # <<<<<<<<<<<<<<
@@ -4362,7 +3999,7 @@ static int __pyx_f_5pysam_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, v
  * 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);
@@ -4376,7 +4013,7 @@ static int __pyx_f_5pysam_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, v
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_WriteUnraisable("pysam.csamtools.fetch_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_WriteUnraisable("csamtools.fetch_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_a);
@@ -4385,20 +4022,7 @@ static int __pyx_f_5pysam_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, v
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_12PileupColumn_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_12PileupColumn___str__[] = "PileupColumn.__str__(self)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_12PileupColumn_1__str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_12PileupColumn_1__str__, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_12PileupColumn___str__)};
-static PyObject *__pyx_pw_5pysam_9csamtools_12PileupColumn_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_12PileupColumn___str__(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":260
+/* "csamtools.pyx":260
  *         list of reads (:class:`pysam.PileupRead`) aligned to this column
  *     '''
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -4406,7 +4030,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_12PileupColumn_1__str__(PyObject *__
  *             "\n" + "\n".join( map(str, self.pileups) )
  */
 
-static PyObject *__pyx_pf_5pysam_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;
@@ -4418,10 +4045,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   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;
 
-  /* "pysam/csamtools.pyx":261
+  /* "csamtools.pyx":261
  *     '''
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\             # <<<<<<<<<<<<<<
@@ -4430,7 +4058,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
  */
   __Pyx_XDECREF(__pyx_r);
 
-  /* "pysam/csamtools.pyx":262
+  /* "csamtools.pyx":262
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" + "\n".join( map(str, self.pileups) )             # <<<<<<<<<<<<<<
@@ -4440,7 +4068,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   __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 = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "pysam/csamtools.pyx":261
+  /* "csamtools.pyx":261
  *     '''
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\             # <<<<<<<<<<<<<<
@@ -4454,7 +4082,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   __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);
@@ -4465,7 +4093,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   __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))));
@@ -4476,7 +4104,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   __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;
@@ -4488,7 +4116,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-  /* "pysam/csamtools.pyx":262
+  /* "csamtools.pyx":262
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" + "\n".join( map(str, self.pileups) )             # <<<<<<<<<<<<<<
@@ -4500,7 +4128,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   __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))));
@@ -4511,7 +4139,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   __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;
@@ -4535,7 +4163,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("pysam.csamtools.PileupColumn.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupColumn.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -4544,7 +4172,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":264
+/* "csamtools.pyx":264
  *             "\n" + "\n".join( map(str, self.pileups) )
  * 
  * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f):             # <<<<<<<<<<<<<<
@@ -4552,7 +4180,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12PileupColumn___str__(CYTHON_UNUSED
  * 
  */
 
-static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __pyx_v_pos, int __pyx_v_n, bam_pileup1_t *__pyx_v_pl, void *__pyx_v_f) {
+static int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __pyx_v_pos, int __pyx_v_n, bam_pileup1_t *__pyx_v_pl, void *__pyx_v_f) {
   PyObject *__pyx_v_p = NULL;
   PyObject *__pyx_v_pileups = NULL;
   int __pyx_v_x;
@@ -4566,10 +4194,10 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
   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);
 
-  /* "pysam/csamtools.pyx":281
+  /* "csamtools.pyx":281
  *     '''
  * 
  *     p = PileupColumn()             # <<<<<<<<<<<<<<
@@ -4584,7 +4212,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
   __pyx_v_p = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":282
+  /* "csamtools.pyx":282
  * 
  *     p = PileupColumn()
  *     p.tid = tid             # <<<<<<<<<<<<<<
@@ -4596,7 +4224,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
   if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__tid, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":283
+  /* "csamtools.pyx":283
  *     p = PileupColumn()
  *     p.tid = tid
  *     p.pos = pos             # <<<<<<<<<<<<<<
@@ -4608,7 +4236,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
   if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pos, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":284
+  /* "csamtools.pyx":284
  *     p.tid = tid
  *     p.pos = pos
  *     p.n = n             # <<<<<<<<<<<<<<
@@ -4620,7 +4248,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
   if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__n, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":285
+  /* "csamtools.pyx":285
  *     p.pos = pos
  *     p.n = n
  *     pileups = []             # <<<<<<<<<<<<<<
@@ -4628,11 +4256,11 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
  *     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;
 
-  /* "pysam/csamtools.pyx":288
+  /* "csamtools.pyx":288
  * 
  *     cdef int x
  *     for x from 0 <= x < n:             # <<<<<<<<<<<<<<
@@ -4642,20 +4270,23 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
   __pyx_t_3 = __pyx_v_n;
   for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
 
-    /* "pysam/csamtools.pyx":289
+    /* "csamtools.pyx":289
  *     cdef int x
  *     for x from 0 <= x < n:
  *         pileups.append( makePileupRead( &(pl[x]) ) )             # <<<<<<<<<<<<<<
  *     p.pileups = pileups
  * 
  */
-    __pyx_t_2 = __pyx_f_5pysam_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;}
+    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;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   }
 
-  /* "pysam/csamtools.pyx":290
+  /* "csamtools.pyx":290
  *     for x from 0 <= x < n:
  *         pileups.append( makePileupRead( &(pl[x]) ) )
  *     p.pileups = pileups             # <<<<<<<<<<<<<<
@@ -4664,7 +4295,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
  */
   if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pileups, ((PyObject *)__pyx_v_pileups)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":292
+  /* "csamtools.pyx":292
  *     p.pileups = pileups
  * 
  *     (<object>f)(p)             # <<<<<<<<<<<<<<
@@ -4672,7 +4303,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
  * 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);
@@ -4686,7 +4317,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_WriteUnraisable("pysam.csamtools.pileup_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_WriteUnraisable("csamtools.pileup_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_p);
@@ -4696,7 +4327,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":294
+/* "csamtools.pyx":294
  *     (<object>f)(p)
  * 
  * cdef int pileup_fetch_callback( bam1_t *b, void *data):             # <<<<<<<<<<<<<<
@@ -4704,15 +4335,15 @@ static int __pyx_f_5pysam_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint3
  * 
  */
 
-static int __pyx_f_5pysam_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__pyx_v_data) {
+static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__pyx_v_data) {
   bam_plbuf_t *__pyx_v_buf;
   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);
 
-  /* "pysam/csamtools.pyx":300
+  /* "csamtools.pyx":300
  *     '''
  *     cdef bam_plbuf_t * buf
  *     buf = <bam_plbuf_t*>data             # <<<<<<<<<<<<<<
@@ -4721,7 +4352,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, vo
  */
   __pyx_v_buf = ((bam_plbuf_t *)__pyx_v_data);
 
-  /* "pysam/csamtools.pyx":301
+  /* "csamtools.pyx":301
  *     cdef bam_plbuf_t * buf
  *     buf = <bam_plbuf_t*>data
  *     bam_plbuf_push(b, buf)             # <<<<<<<<<<<<<<
@@ -4730,7 +4361,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, vo
  */
   bam_plbuf_push(__pyx_v_b, __pyx_v_buf);
 
-  /* "pysam/csamtools.pyx":302
+  /* "csamtools.pyx":302
  *     buf = <bam_plbuf_t*>data
  *     bam_plbuf_push(b, buf)
  *     return 0             # <<<<<<<<<<<<<<
@@ -4747,20 +4378,7 @@ static int __pyx_f_5pysam_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, vo
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_11StderrStore___init__[] = "StderrStore.__init__(self)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_11StderrStore_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_11StderrStore_1__init__, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_11StderrStore___init__)};
-static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11StderrStore___init__(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":308
+/* "csamtools.pyx":308
  *     stderr is captured.
  *     '''
  *     def __init__(self):             # <<<<<<<<<<<<<<
@@ -4768,14 +4386,18 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_1__init__(PyObject *__
  *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
  */
 
-static PyObject *__pyx_pf_5pysam_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;
 
-  /* "pysam/csamtools.pyx":309
+  /* "csamtools.pyx":309
  *     '''
  *     def __init__(self):
  *         return             # <<<<<<<<<<<<<<
@@ -4794,20 +4416,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore___init__(CYTHON_UNUSED
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_11StderrStore_2readAndRelease[] = "StderrStore.readAndRelease(self)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_11StderrStore_3readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pw_5pysam_9csamtools_11StderrStore_3readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_11StderrStore_2readAndRelease)};
-static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("readAndRelease (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11StderrStore_2readAndRelease(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":314
+/* "csamtools.pyx":314
  *         self.stderr_save.setfd( self.stderr_h )
  * 
  *     def readAndRelease( self ):             # <<<<<<<<<<<<<<
@@ -4815,7 +4424,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_3readAndRelease(PyObje
  *         self.stderr_save.restore()
  */
 
-static PyObject *__pyx_pf_5pysam_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;
@@ -4823,10 +4435,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_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], 314);
+  __pyx_self = __pyx_self;
 
-  /* "pysam/csamtools.pyx":315
+  /* "csamtools.pyx":315
  * 
  *     def readAndRelease( self ):
  *         return []             # <<<<<<<<<<<<<<
@@ -4835,7 +4448,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_2readAndRelease(CYTHON
  */
   __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;
@@ -4844,7 +4457,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_2readAndRelease(CYTHON
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.StderrStore.readAndRelease", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.StderrStore.readAndRelease", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -4853,20 +4466,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_2readAndRelease(CYTHON
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_5release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_11StderrStore_4release[] = "StderrStore.release(self)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_11StderrStore_5release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pw_5pysam_9csamtools_11StderrStore_5release, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_11StderrStore_4release)};
-static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_5release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("release (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11StderrStore_4release(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":323
+/* "csamtools.pyx":323
  *         return lines
  * 
  *     def release(self):             # <<<<<<<<<<<<<<
@@ -4874,14 +4474,18 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_5release(PyObject *__p
  *         self.stderr_save.restore()
  */
 
-static PyObject *__pyx_pf_5pysam_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;
 
-  /* "pysam/csamtools.pyx":324
+  /* "csamtools.pyx":324
  * 
  *     def release(self):
  *         return             # <<<<<<<<<<<<<<
@@ -4900,20 +4504,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_4release(CYTHON_UNUSED
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_7__del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_11StderrStore_6__del__[] = "StderrStore.__del__(self)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_11StderrStore_7__del__ = {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_11StderrStore_7__del__, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_11StderrStore_6__del__)};
-static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_7__del__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11StderrStore_6__del__(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":329
+/* "csamtools.pyx":329
  *             os.remove( self.stderr_f )
  * 
  *     def __del__(self):             # <<<<<<<<<<<<<<
@@ -4921,7 +4512,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11StderrStore_7__del__(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_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;
@@ -4930,10 +4524,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED
   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;
 
-  /* "pysam/csamtools.pyx":330
+  /* "csamtools.pyx":330
  * 
  *     def __del__(self):
  *         self.release()             # <<<<<<<<<<<<<<
@@ -4952,7 +4547,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.StderrStore.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.StderrStore.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -4961,20 +4556,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_18StderrStoreWindows___init__[] = "StderrStoreWindows.__init__(self)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_18StderrStoreWindows_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_1__init__, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_18StderrStoreWindows___init__)};
-static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_18StderrStoreWindows___init__(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":334
+/* "csamtools.pyx":334
  * class StderrStoreWindows():
  *     '''does nothing. stderr can't be redirected on windows'''
  *     def __init__(self): pass             # <<<<<<<<<<<<<<
@@ -4982,12 +4564,16 @@ static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_1__init__(PyObj
  *     def release(self): pass
  */
 
-static PyObject *__pyx_pf_5pysam_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);
@@ -4996,20 +4582,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18StderrStoreWindows___init__(CYTHON
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_18StderrStoreWindows_2readAndRelease[] = "StderrStoreWindows.readAndRelease(self)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_18StderrStoreWindows_3readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_3readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_18StderrStoreWindows_2readAndRelease)};
-static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("readAndRelease (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_18StderrStoreWindows_2readAndRelease(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":335
+/* "csamtools.pyx":335
  *     '''does nothing. stderr can't be redirected on windows'''
  *     def __init__(self): pass
  *     def readAndRelease(self): return []             # <<<<<<<<<<<<<<
@@ -5017,7 +4590,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_3readAndRelease
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_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;
@@ -5025,11 +4601,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18StderrStoreWindows_2readAndRelease
   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;
@@ -5038,7 +4615,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18StderrStoreWindows_2readAndRelease
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.StderrStoreWindows.readAndRelease", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.StderrStoreWindows.readAndRelease", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -5047,20 +4624,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18StderrStoreWindows_2readAndRelease
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_5release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_18StderrStoreWindows_4release[] = "StderrStoreWindows.release(self)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_18StderrStoreWindows_5release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_5release, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_18StderrStoreWindows_4release)};
-static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_5release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("release (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_18StderrStoreWindows_4release(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":336
+/* "csamtools.pyx":336
  *     def __init__(self): pass
  *     def readAndRelease(self): return []
  *     def release(self): pass             # <<<<<<<<<<<<<<
@@ -5068,12 +4632,16 @@ static PyObject *__pyx_pw_5pysam_9csamtools_18StderrStoreWindows_5release(PyObje
  * if platform.system()=='Windows':
  */
 
-static PyObject *__pyx_pf_5pysam_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);
@@ -5082,28 +4650,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18StderrStoreWindows_4release(CYTHON
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_9Fastafile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_9Fastafile___cinit__(((struct __pyx_obj_5pysam_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;
-}
-
-/* "pysam/csamtools.pyx":387
+/* "csamtools.pyx":387
  *     '''
  * 
  *     def __cinit__(self, *args, **kwargs ):             # <<<<<<<<<<<<<<
@@ -5111,57 +4658,62 @@ static int __pyx_pw_5pysam_9csamtools_9Fastafile_1__cinit__(PyObject *__pyx_v_se
  *         self._filename = NULL
  */
 
-static int __pyx_pf_5pysam_9csamtools_9Fastafile___cinit__(struct __pyx_obj_5pysam_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;
 
-  /* "pysam/csamtools.pyx":388
+  /* "csamtools.pyx":388
  * 
  *     def __cinit__(self, *args, **kwargs ):
  *         self.fastafile = NULL             # <<<<<<<<<<<<<<
  *         self._filename = NULL
  *         self._open( *args, **kwargs )
  */
-  __pyx_v_self->fastafile = NULL;
+  ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = NULL;
 
-  /* "pysam/csamtools.pyx":389
+  /* "csamtools.pyx":389
  *     def __cinit__(self, *args, **kwargs ):
  *         self.fastafile = NULL
  *         self._filename = NULL             # <<<<<<<<<<<<<<
  *         self._open( *args, **kwargs )
  * 
  */
-  __pyx_v_self->_filename = NULL;
+  ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = NULL;
 
-  /* "pysam/csamtools.pyx":390
+  /* "csamtools.pyx":390
  *         self.fastafile = NULL
  *         self._filename = NULL
  *         self._open( *args, **kwargs )             # <<<<<<<<<<<<<<
  * 
  *     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;
@@ -5169,28 +4721,17 @@ static int __pyx_pf_5pysam_9csamtools_9Fastafile___cinit__(struct __pyx_obj_5pys
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.Fastafile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __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_5pysam_9csamtools_9Fastafile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_9Fastafile_2_isOpen[] = "Fastafile._isOpen(self)\nreturn true if samfile has been opened.";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_9Fastafile_2_isOpen(((struct __pyx_obj_5pysam_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":392
+/* "csamtools.pyx":392
  *         self._open( *args, **kwargs )
  * 
  *     def _isOpen( self ):             # <<<<<<<<<<<<<<
@@ -5198,7 +4739,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_3_isOpen(PyObject *__pyx_
  *         return self.fastafile != NULL
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_5pysam_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;
@@ -5206,10 +4749,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj
   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);
 
-  /* "pysam/csamtools.pyx":394
+  /* "csamtools.pyx":394
  *     def _isOpen( self ):
  *         '''return true if samfile has been opened.'''
  *         return self.fastafile != NULL             # <<<<<<<<<<<<<<
@@ -5217,7 +4760,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj
  *     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;
@@ -5227,7 +4770,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.Fastafile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Fastafile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -5236,18 +4779,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static Py_ssize_t __pyx_pw_5pysam_9csamtools_9Fastafile_5__len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pw_5pysam_9csamtools_9Fastafile_5__len__(PyObject *__pyx_v_self) {
-  Py_ssize_t __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_9Fastafile_4__len__(((struct __pyx_obj_5pysam_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":396
+/* "csamtools.pyx":396
  *         return self.fastafile != NULL
  * 
  *     def __len__(self):             # <<<<<<<<<<<<<<
@@ -5255,7 +4787,8 @@ static Py_ssize_t __pyx_pw_5pysam_9csamtools_9Fastafile_5__len__(PyObject *__pyx
  *             raise ValueError( "calling len() on closed file" )
  */
 
-static Py_ssize_t __pyx_pf_5pysam_9csamtools_9Fastafile_4__len__(struct __pyx_obj_5pysam_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;
@@ -5264,20 +4797,20 @@ static Py_ssize_t __pyx_pf_5pysam_9csamtools_9Fastafile_4__len__(struct __pyx_ob
   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);
 
-  /* "pysam/csamtools.pyx":397
+  /* "csamtools.pyx":397
  * 
  *     def __len__(self):
  *         if self.fastafile == NULL:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":398
+    /* "csamtools.pyx":398
  *     def __len__(self):
  *         if self.fastafile == NULL:
  *             raise ValueError( "calling len() on closed file" )             # <<<<<<<<<<<<<<
@@ -5289,25 +4822,25 @@ static Py_ssize_t __pyx_pf_5pysam_9csamtools_9Fastafile_4__len__(struct __pyx_ob
     __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:;
 
-  /* "pysam/csamtools.pyx":400
+  /* "csamtools.pyx":400
  *             raise ValueError( "calling len() on closed file" )
  * 
  *         return faidx_fetch_nseq(self.fastafile)             # <<<<<<<<<<<<<<
  * 
  *     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;
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Fastafile.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Fastafile.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -5315,19 +4848,7 @@ static Py_ssize_t __pyx_pf_5pysam_9csamtools_9Fastafile_4__len__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
-static char __pyx_doc_5pysam_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_5pysam_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_5pysam_9csamtools_9Fastafile_6_open(((struct __pyx_obj_5pysam_9csamtools_Fastafile *)__pyx_v_self), ((PyObject *)__pyx_v_filename));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":402
+/* "csamtools.pyx":402
  *         return faidx_fetch_nseq(self.fastafile)
  * 
  *     def _open( self,             # <<<<<<<<<<<<<<
@@ -5335,7 +4856,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_7_open(PyObject *__pyx_v_
  *         '''open an indexed fasta file.
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_6_open(struct __pyx_obj_5pysam_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;
@@ -5346,57 +4869,57 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_6_open(struct __pyx_obj_5
   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);
 
-  /* "pysam/csamtools.pyx":410
+  /* "csamtools.pyx":410
  * 
  *         # close a previously opened file
  *         if self.fastafile != NULL: self.close()             # <<<<<<<<<<<<<<
  *         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:;
 
-  /* "pysam/csamtools.pyx":411
+  /* "csamtools.pyx":411
  *         # close a previously opened file
  *         if self.fastafile != NULL: self.close()
  *         if self._filename != NULL: free(self._filename)             # <<<<<<<<<<<<<<
  *         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:;
 
-  /* "pysam/csamtools.pyx":412
+  /* "csamtools.pyx":412
  *         if self.fastafile != NULL: self.close()
  *         if self._filename != NULL: free(self._filename)
  *         filename = _my_encodeFilename(filename)             # <<<<<<<<<<<<<<
  *         self._filename = strdup(filename)
  *         self.fastafile = fai_load( filename )
  */
-  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_9csamtools__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = ((PyObject *)__pyx_f_9csamtools__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_v_filename);
   __pyx_v_filename = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":413
+  /* "csamtools.pyx":413
  *         if self._filename != NULL: free(self._filename)
  *         filename = _my_encodeFilename(filename)
  *         self._filename = strdup(filename)             # <<<<<<<<<<<<<<
@@ -5404,9 +4927,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_6_open(struct __pyx_obj_5
  * 
  */
   __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);
 
-  /* "pysam/csamtools.pyx":414
+  /* "csamtools.pyx":414
  *         filename = _my_encodeFilename(filename)
  *         self._filename = strdup(filename)
  *         self.fastafile = fai_load( filename )             # <<<<<<<<<<<<<<
@@ -5414,19 +4937,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_6_open(struct __pyx_obj_5
  *         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);
 
-  /* "pysam/csamtools.pyx":416
+  /* "csamtools.pyx":416
  *         self.fastafile = fai_load( filename )
  * 
  *         if self.fastafile == NULL:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":417
+    /* "csamtools.pyx":417
  * 
  *         if self.fastafile == NULL:
  *             raise IOError("could not open file `%s`" % filename )             # <<<<<<<<<<<<<<
@@ -5436,7 +4959,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_6_open(struct __pyx_obj_5
     __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;
@@ -5446,16 +4969,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_6_open(struct __pyx_obj_5
     __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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.Fastafile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Fastafile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_filename);
@@ -5465,19 +4988,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_6_open(struct __pyx_obj_5
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_9close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_9Fastafile_8close[] = "Fastafile.close(self)";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_9Fastafile_8close(((struct __pyx_obj_5pysam_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":419
+/* "csamtools.pyx":419
  *             raise IOError("could not open file `%s`" % filename )
  * 
  *     def close( self ):             # <<<<<<<<<<<<<<
@@ -5485,44 +4996,46 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_9close(PyObject *__pyx_v_
  *             fai_destroy( self.fastafile )
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8close(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":420
+  /* "csamtools.pyx":420
  * 
  *     def close( self ):
  *         if self.fastafile != NULL:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":421
+    /* "csamtools.pyx":421
  *     def close( self ):
  *         if self.fastafile != NULL:
  *             fai_destroy( self.fastafile )             # <<<<<<<<<<<<<<
  *             self.fastafile = NULL
  * 
  */
-    fai_destroy(__pyx_v_self->fastafile);
+    fai_destroy(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile);
 
-    /* "pysam/csamtools.pyx":422
+    /* "csamtools.pyx":422
  *         if self.fastafile != NULL:
  *             fai_destroy( self.fastafile )
  *             self.fastafile = NULL             # <<<<<<<<<<<<<<
  * 
  *     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);
@@ -5531,16 +5044,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8close(struct __pyx_obj_5
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_5pysam_9csamtools_9Fastafile_11__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5pysam_9csamtools_9Fastafile_11__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_5pysam_9csamtools_9Fastafile_10__dealloc__(((struct __pyx_obj_5pysam_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "pysam/csamtools.pyx":424
+/* "csamtools.pyx":424
  *             self.fastafile = NULL
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -5548,7 +5052,8 @@ static void __pyx_pw_5pysam_9csamtools_9Fastafile_11__dealloc__(PyObject *__pyx_
  *         if self._filename != NULL: free(self._filename)
  */
 
-static void __pyx_pf_5pysam_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_5pysam_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;
@@ -5557,59 +5062,48 @@ static void __pyx_pf_5pysam_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj
   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);
 
-  /* "pysam/csamtools.pyx":425
+  /* "csamtools.pyx":425
  * 
  *     def __dealloc__(self):
  *         self.close()             # <<<<<<<<<<<<<<
  *         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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":426
+  /* "csamtools.pyx":426
  *     def __dealloc__(self):
  *         self.close()
  *         if self._filename != NULL: free(self._filename)             # <<<<<<<<<<<<<<
  * 
  *     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:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Fastafile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Fastafile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_8filename_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_9Fastafile_8filename___get__(((struct __pyx_obj_5pysam_9csamtools_Fastafile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":430
+/* "csamtools.pyx":430
  *     property filename:
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -5617,7 +5111,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_8filename_1__get__(PyObje
  *             return self._filename
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8filename___get__(struct __pyx_obj_5pysam_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;
@@ -5628,17 +5123,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8filename___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], 430);
 
-  /* "pysam/csamtools.pyx":431
+  /* "csamtools.pyx":431
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             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);
@@ -5652,11 +5147,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8filename___get__(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 = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":432
+  /* "csamtools.pyx":432
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             return self._filename             # <<<<<<<<<<<<<<
@@ -5664,7 +5159,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8filename___get__(struct
  *     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;
@@ -5675,7 +5170,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8filename___get__(struct
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Fastafile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Fastafile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -5684,22 +5179,42 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_8filename___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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 *refe [...]
-static PyObject *__pyx_pw_5pysam_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;
-  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
     PyObject* values[4] = {0,0,0,0};
 
-    /* "pysam/csamtools.pyx":435
+    /* "csamtools.pyx":435
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -5708,7 +5223,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":436
+    /* "csamtools.pyx":436
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -5717,7 +5232,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":437
+    /* "csamtools.pyx":437
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -5726,7 +5241,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":438
+    /* "csamtools.pyx":438
  *                start = None,
  *                end = None,
  *                region = None):             # <<<<<<<<<<<<<<
@@ -5736,8 +5251,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v
     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);
@@ -5746,7 +5260,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch(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:
         if (kw_args > 0) {
           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
@@ -5769,7 +5283,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v
         }
       }
       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)) {
@@ -5790,52 +5304,22 @@ static PyObject *__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Fastafile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Fastafile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(((struct __pyx_obj_5pysam_9csamtools_Fastafile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":434
- *             return self._filename
- * 
- *     def fetch( self,             # <<<<<<<<<<<<<<
- *                reference = None,
- *                start = None,
- */
-
-static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":455
+  /* "csamtools.pyx":455
  *         '''
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             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);
@@ -5845,7 +5329,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":456
+    /* "csamtools.pyx":456
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -5857,11 +5341,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(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 = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":461
+  /* "csamtools.pyx":461
  *         cdef char * seq
  * 
  *         if not region:             # <<<<<<<<<<<<<<
@@ -5872,7 +5356,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":462
+    /* "csamtools.pyx":462
  * 
  *         if not region:
  *             if reference is None: raise ValueError( 'no sequence/region supplied.' )             # <<<<<<<<<<<<<<
@@ -5886,11 +5370,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(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 = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L5;
+      goto __pyx_L8;
     }
-    __pyx_L5:;
+    __pyx_L8:;
 
-    /* "pysam/csamtools.pyx":463
+    /* "csamtools.pyx":463
  *         if not region:
  *             if reference is None: raise ValueError( 'no sequence/region supplied.' )
  *             if start is None: start = 0             # <<<<<<<<<<<<<<
@@ -5902,11 +5386,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
       __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:;
 
-    /* "pysam/csamtools.pyx":464
+    /* "csamtools.pyx":464
  *             if reference is None: raise ValueError( 'no sequence/region supplied.' )
  *             if start is None: start = 0
  *             if end is None: end = max_pos -1             # <<<<<<<<<<<<<<
@@ -5915,28 +5399,29 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
  */
     __pyx_t_3 = (__pyx_v_end == Py_None);
     if (__pyx_t_3) {
-      __pyx_t_2 = PyInt_FromLong((__pyx_v_5pysam_9csamtools_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromLong((__pyx_v_9csamtools_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __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:;
 
-    /* "pysam/csamtools.pyx":466
+    /* "csamtools.pyx":466
  *             if end is None: end = max_pos -1
  * 
  *             if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) )             # <<<<<<<<<<<<<<
  *             if start == end: return b""
  *             # valid ranges are from 0 to 2^29-1
  */
-    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_GT); 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_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __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);
@@ -5947,7 +5432,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
       __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;
@@ -5957,18 +5442,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(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 = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L8;
+      goto __pyx_L11;
     }
-    __pyx_L8:;
+    __pyx_L11:;
 
-    /* "pysam/csamtools.pyx":467
+    /* "csamtools.pyx":467
  * 
  *             if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) )
  *             if start == end: return b""             # <<<<<<<<<<<<<<
  *             # valid ranges are from 0 to 2^29-1
  *             if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (__pyx_t_3) {
@@ -5976,23 +5462,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
       __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:;
 
-    /* "pysam/csamtools.pyx":469
+    /* "csamtools.pyx":469
  *             if start == end: return b""
  *             # valid ranges are from 0 to 2^29-1
  *             if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )             # <<<<<<<<<<<<<<
  *             if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end )
  *             # note: faidx_fetch_seq has a bug such that out-of-range access
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_start, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_start, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
       __Pyx_DECREF(__pyx_t_1);
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_5pysam_9csamtools_max_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromLong(__pyx_v_9csamtools_max_pos); 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_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     }
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6002,7 +5490,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
       __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;
@@ -6012,23 +5500,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(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 = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L10;
+      goto __pyx_L13;
     }
-    __pyx_L10:;
+    __pyx_L13:;
 
-    /* "pysam/csamtools.pyx":470
+    /* "csamtools.pyx":470
  *             # valid ranges are from 0 to 2^29-1
  *             if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )
  *             if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end )             # <<<<<<<<<<<<<<
  *             # note: faidx_fetch_seq has a bug such that out-of-range access
  *             # always returns the last residue. Hence do not use faidx_fetch_seq,
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_end, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_end, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
       __Pyx_DECREF(__pyx_t_1);
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_5pysam_9csamtools_max_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromLong(__pyx_v_9csamtools_max_pos); 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_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     }
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6038,7 +5528,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
       __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;
@@ -6048,11 +5538,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(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 = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L11;
+      goto __pyx_L14;
     }
-    __pyx_L11:;
+    __pyx_L14:;
 
-    /* "pysam/csamtools.pyx":479
+    /* "csamtools.pyx":479
  *             #                       end-1,
  *             #                       &length)
  *             region = "%s:%i-%i" % (reference, start+1, end)             # <<<<<<<<<<<<<<
@@ -6062,7 +5552,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
     __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);
@@ -6079,7 +5569,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
     __pyx_v_region = ((PyObject *)__pyx_t_1);
     __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":480
+    /* "csamtools.pyx":480
  *             #                       &length)
  *             region = "%s:%i-%i" % (reference, start+1, end)
  *             if PY_MAJOR_VERSION >= 3:             # <<<<<<<<<<<<<<
@@ -6089,7 +5579,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
     __pyx_t_3 = (PY_MAJOR_VERSION >= 3);
     if (__pyx_t_3) {
 
-      /* "pysam/csamtools.pyx":481
+      /* "csamtools.pyx":481
  *             region = "%s:%i-%i" % (reference, start+1, end)
  *             if PY_MAJOR_VERSION >= 3:
  *                 region = region.encode('ascii')             # <<<<<<<<<<<<<<
@@ -6104,11 +5594,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
       __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:;
 
-    /* "pysam/csamtools.pyx":483
+    /* "csamtools.pyx":483
  *                 region = region.encode('ascii')
  *             seq = fai_fetch( self.fastafile,
  *                              region,             # <<<<<<<<<<<<<<
@@ -6117,19 +5607,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
  */
     __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "pysam/csamtools.pyx":484
+    /* "csamtools.pyx":484
  *             seq = fai_fetch( self.fastafile,
  *                              region,
  *                              &length )             # <<<<<<<<<<<<<<
  *         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*/ {
 
-    /* "pysam/csamtools.pyx":487
+    /* "csamtools.pyx":487
  *         else:
  *             # samtools adds a '\0' at the end
  *             seq = fai_fetch( self.fastafile, region, &length )             # <<<<<<<<<<<<<<
@@ -6137,11 +5627,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
  *         # 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:;
 
-  /* "pysam/csamtools.pyx":490
+  /* "csamtools.pyx":490
  * 
  *         # copy to python
  *         if seq == NULL:             # <<<<<<<<<<<<<<
@@ -6151,7 +5641,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
   __pyx_t_3 = (__pyx_v_seq == NULL);
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":491
+    /* "csamtools.pyx":491
  *         # copy to python
  *         if seq == NULL:
  *             return b""             # <<<<<<<<<<<<<<
@@ -6162,11 +5652,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
     __Pyx_INCREF(((PyObject *)__pyx_kp_b_16));
     __pyx_r = ((PyObject *)__pyx_kp_b_16);
     goto __pyx_L0;
-    goto __pyx_L13;
+    goto __pyx_L16;
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":493
+    /* "csamtools.pyx":493
  *             return b""
  *         else:
  *             try:             # <<<<<<<<<<<<<<
@@ -6175,20 +5665,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
  */
     /*try:*/ {
 
-      /* "pysam/csamtools.pyx":494
+      /* "csamtools.pyx":494
  *         else:
  *             try:
  *                 py_seq = seq[:length]             # <<<<<<<<<<<<<<
  *             finally:
  *                 free(seq)
  */
-      __pyx_t_2 = PyBytes_FromStringAndSize(((const char*)__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;
     }
 
-    /* "pysam/csamtools.pyx":496
+    /* "csamtools.pyx":496
  *                 py_seq = seq[:length]
  *             finally:
  *                 free(seq)             # <<<<<<<<<<<<<<
@@ -6200,16 +5690,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
       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: {
@@ -6223,9 +5713,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
       }
     }
   }
-  __pyx_L13:;
+  __pyx_L16:;
 
-  /* "pysam/csamtools.pyx":498
+  /* "csamtools.pyx":498
  *                 free(seq)
  * 
  *         return py_seq             # <<<<<<<<<<<<<<
@@ -6242,7 +5732,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Fastafile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Fastafile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_py_seq);
@@ -6255,7 +5745,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":500
+/* "csamtools.pyx":500
  *         return py_seq
  * 
  *     cdef char * _fetch( self, char * reference, int start, int end, int * length ):             # <<<<<<<<<<<<<<
@@ -6263,14 +5753,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_9Fastafile_12fetch(struct __pyx_obj_
  * 
  */
 
-static char *__pyx_f_5pysam_9csamtools_9Fastafile__fetch(struct __pyx_obj_5pysam_9csamtools_Fastafile *__pyx_v_self, char *__pyx_v_reference, int __pyx_v_start, int __pyx_v_end, int *__pyx_v_length) {
+static char *__pyx_f_9csamtools_9Fastafile__fetch(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, char *__pyx_v_reference, int __pyx_v_start, int __pyx_v_end, int *__pyx_v_length) {
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("_fetch", 0);
+  __Pyx_RefNannySetupContext("_fetch");
   __Pyx_TraceCall("_fetch", __pyx_f[0], 500);
 
-  /* "pysam/csamtools.pyx":507
+  /* "csamtools.pyx":507
  *                                start,
  *                                end-1,
  *                                length )             # <<<<<<<<<<<<<<
@@ -6287,7 +5777,7 @@ static char *__pyx_f_5pysam_9csamtools_9Fastafile__fetch(struct __pyx_obj_5pysam
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":512
+/* "csamtools.pyx":512
  * #------------------------------------------------------------------------
  * #------------------------------------------------------------------------
  * cdef int count_callback( bam1_t *alignment, void *f):             # <<<<<<<<<<<<<<
@@ -6295,16 +5785,16 @@ static char *__pyx_f_5pysam_9csamtools_9Fastafile__fetch(struct __pyx_obj_5pysam
  *      '''
  */
 
-static int __pyx_f_5pysam_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);
 
-  /* "pysam/csamtools.pyx":515
+  /* "csamtools.pyx":515
  *      '''callback for bam_fetch - count number of reads.
  *      '''
  *      cdef int* counter = (<int*>f)             # <<<<<<<<<<<<<<
@@ -6313,7 +5803,7 @@ static int __pyx_f_5pysam_9csamtools_count_callback(CYTHON_UNUSED bam1_t *__pyx_
  */
   __pyx_v_counter = ((int *)__pyx_v_f);
 
-  /* "pysam/csamtools.pyx":516
+  /* "csamtools.pyx":516
  *      '''
  *      cdef int* counter = (<int*>f)
  *      counter[0] += 1;             # <<<<<<<<<<<<<<
@@ -6329,7 +5819,7 @@ static int __pyx_f_5pysam_9csamtools_count_callback(CYTHON_UNUSED bam1_t *__pyx_
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":526
+/* "csamtools.pyx":526
  * #------------------------------------------------------------------------
  * #------------------------------------------------------------------------
  * cdef int mate_callback( bam1_t *alignment, void *f):             # <<<<<<<<<<<<<<
@@ -6337,27 +5827,27 @@ static int __pyx_f_5pysam_9csamtools_count_callback(CYTHON_UNUSED bam1_t *__pyx_
  *      '''
  */
 
-static int __pyx_f_5pysam_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
-  __pyx_t_5pysam_9csamtools_MateData *__pyx_v_d;
+static int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
+  __pyx_t_9csamtools_MateData *__pyx_v_d;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   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);
 
-  /* "pysam/csamtools.pyx":529
+  /* "csamtools.pyx":529
  *      '''callback for bam_fetch = filter mate
  *      '''
  *      cdef MateData * d = (<MateData*>f)             # <<<<<<<<<<<<<<
  *      # printf("mate = %p, name1 = %s, name2=%s\t%i\t%i\t%i\n",
  *      #        d.mate, d.name, bam1_qname(alignment),
  */
-  __pyx_v_d = ((__pyx_t_5pysam_9csamtools_MateData *)__pyx_v_f);
+  __pyx_v_d = ((__pyx_t_9csamtools_MateData *)__pyx_v_f);
 
-  /* "pysam/csamtools.pyx":534
+  /* "csamtools.pyx":534
  *      #        d.flag, alignment.core.flag, alignment.core.flag & d.flag)
  * 
  *      if d.mate == NULL:             # <<<<<<<<<<<<<<
@@ -6367,7 +5857,7 @@ static int __pyx_f_5pysam_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, vo
   __pyx_t_1 = (__pyx_v_d->mate == NULL);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":540
+    /* "csamtools.pyx":540
  *          # also, make sure that we get the other read by comparing
  *          # the flags
  *          if alignment.core.flag & d.flag != 0 and \             # <<<<<<<<<<<<<<
@@ -6377,7 +5867,7 @@ static int __pyx_f_5pysam_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, vo
     __pyx_t_1 = ((__pyx_v_alignment->core.flag & __pyx_v_d->flag) != 0);
     if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":541
+      /* "csamtools.pyx":541
  *          # the flags
  *          if alignment.core.flag & d.flag != 0 and \
  *                  strcmp( bam1_qname( alignment ), d.name ) == 0:             # <<<<<<<<<<<<<<
@@ -6391,7 +5881,7 @@ static int __pyx_f_5pysam_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, vo
     }
     if (__pyx_t_3) {
 
-      /* "pysam/csamtools.pyx":542
+      /* "csamtools.pyx":542
  *          if alignment.core.flag & d.flag != 0 and \
  *                  strcmp( bam1_qname( alignment ), d.name ) == 0:
  *              d.mate = bam_dup1( alignment )             # <<<<<<<<<<<<<<
@@ -6412,28 +5902,7 @@ static int __pyx_f_5pysam_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, vo
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_7Samfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_7Samfile___cinit__(((struct __pyx_obj_5pysam_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;
-}
-
-/* "pysam/csamtools.pyx":592
+/* "csamtools.pyx":592
  *     '''
  * 
  *     def __cinit__(self, *args, **kwargs ):             # <<<<<<<<<<<<<<
@@ -6441,84 +5910,89 @@ static int __pyx_pw_5pysam_9csamtools_7Samfile_1__cinit__(PyObject *__pyx_v_self
  *         self._filename = NULL
  */
 
-static int __pyx_pf_5pysam_9csamtools_7Samfile___cinit__(struct __pyx_obj_5pysam_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;
 
-  /* "pysam/csamtools.pyx":593
+  /* "csamtools.pyx":593
  * 
  *     def __cinit__(self, *args, **kwargs ):
  *         self.samfile = NULL             # <<<<<<<<<<<<<<
  *         self._filename = NULL
  *         self.isbam = False
  */
-  __pyx_v_self->samfile = NULL;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
 
-  /* "pysam/csamtools.pyx":594
+  /* "csamtools.pyx":594
  *     def __cinit__(self, *args, **kwargs ):
  *         self.samfile = NULL
  *         self._filename = NULL             # <<<<<<<<<<<<<<
  *         self.isbam = False
  *         self.isstream = False
  */
-  __pyx_v_self->_filename = NULL;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = NULL;
 
-  /* "pysam/csamtools.pyx":595
+  /* "csamtools.pyx":595
  *         self.samfile = NULL
  *         self._filename = NULL
  *         self.isbam = False             # <<<<<<<<<<<<<<
  *         self.isstream = False
  *         self._open( *args, **kwargs )
  */
-  __pyx_v_self->isbam = 0;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = 0;
 
-  /* "pysam/csamtools.pyx":596
+  /* "csamtools.pyx":596
  *         self._filename = NULL
  *         self.isbam = False
  *         self.isstream = False             # <<<<<<<<<<<<<<
  *         self._open( *args, **kwargs )
  * 
  */
-  __pyx_v_self->isstream = 0;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = 0;
 
-  /* "pysam/csamtools.pyx":597
+  /* "csamtools.pyx":597
  *         self.isbam = False
  *         self.isstream = False
  *         self._open( *args, **kwargs )             # <<<<<<<<<<<<<<
  * 
  *         # 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;
 
-  /* "pysam/csamtools.pyx":600
+  /* "csamtools.pyx":600
  * 
  *         # allocate memory for iterator
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))             # <<<<<<<<<<<<<<
  * 
  *     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;
@@ -6526,28 +6000,17 @@ static int __pyx_pf_5pysam_9csamtools_7Samfile___cinit__(struct __pyx_obj_5pysam
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __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_5pysam_9csamtools_7Samfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_2_isOpen[] = "Samfile._isOpen(self)\nreturn true if samfile has been opened.";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7Samfile_2_isOpen(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":602
+/* "csamtools.pyx":602
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
  * 
  *     def _isOpen( self ):             # <<<<<<<<<<<<<<
@@ -6555,7 +6018,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_3_isOpen(PyObject *__pyx_v_
  *         return self.samfile != NULL
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_5pysam_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;
@@ -6563,10 +6028,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_5
   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);
 
-  /* "pysam/csamtools.pyx":604
+  /* "csamtools.pyx":604
  *     def _isOpen( self ):
  *         '''return true if samfile has been opened.'''
  *         return self.samfile != NULL             # <<<<<<<<<<<<<<
@@ -6574,7 +6039,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_5
  *     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;
@@ -6584,7 +6049,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_5
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -6593,19 +6058,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_5
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_5_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_4_hasIndex[] = "Samfile._hasIndex(self)\nreturn true if samfile has an existing (and opened) index.";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7Samfile_4_hasIndex(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":606
+/* "csamtools.pyx":606
  *         return self.samfile != NULL
  * 
  *     def _hasIndex( self ):             # <<<<<<<<<<<<<<
@@ -6613,7 +6066,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_5_hasIndex(PyObject *__pyx_
  *         return self.index != NULL
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_5pysam_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;
@@ -6621,10 +6076,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj
   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);
 
-  /* "pysam/csamtools.pyx":608
+  /* "csamtools.pyx":608
  *     def _hasIndex( self ):
  *         '''return true if samfile has an existing (and opened) index.'''
  *         return self.index != NULL             # <<<<<<<<<<<<<<
@@ -6632,7 +6087,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj
  *     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;
@@ -6642,7 +6097,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile._hasIndex", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile._hasIndex", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -6651,13 +6106,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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_5pysam_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_5pysam_9csamtools_Samfile *__pyx_v_template = 0;
+  struct __pyx_obj_9csamtools_Samfile *__pyx_v_template = 0;
   PyObject *__pyx_v_referencenames = 0;
   PyObject *__pyx_v_referencelengths = 0;
   PyObject *__pyx_v_text = 0;
@@ -6666,14 +6128,49 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
   PyObject *__pyx_v_add_sq_text = 0;
   PyObject *__pyx_v_check_header = 0;
   PyObject *__pyx_v_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);
   {
-    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* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
 
-    /* "pysam/csamtools.pyx":612
+    /* "csamtools.pyx":612
  *     def _open( self,
  *                filename,
  *                mode = None,             # <<<<<<<<<<<<<<
@@ -6682,16 +6179,16 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":613
+    /* "csamtools.pyx":613
  *                filename,
  *                mode = None,
  *                Samfile template = None,             # <<<<<<<<<<<<<<
  *                referencenames = None,
  *                referencelengths = None,
  */
-    values[2] = (PyObject *)((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None);
+    values[2] = (PyObject *)((struct __pyx_obj_9csamtools_Samfile *)Py_None);
 
-    /* "pysam/csamtools.pyx":614
+    /* "csamtools.pyx":614
  *                mode = None,
  *                Samfile template = None,
  *                referencenames = None,             # <<<<<<<<<<<<<<
@@ -6700,7 +6197,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":615
+    /* "csamtools.pyx":615
  *                Samfile template = None,
  *                referencenames = None,
  *                referencelengths = None,             # <<<<<<<<<<<<<<
@@ -6709,7 +6206,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
  */
     values[4] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":616
+    /* "csamtools.pyx":616
  *                referencenames = None,
  *                referencelengths = None,
  *                text = None,             # <<<<<<<<<<<<<<
@@ -6718,7 +6215,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
  */
     values[5] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":617
+    /* "csamtools.pyx":617
  *                referencelengths = None,
  *                text = None,
  *                header = None,             # <<<<<<<<<<<<<<
@@ -6727,7 +6224,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
  */
     values[6] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":618
+    /* "csamtools.pyx":618
  *                text = None,
  *                header = None,
  *                port = None,             # <<<<<<<<<<<<<<
@@ -6740,8 +6237,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
     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);
@@ -6757,9 +6253,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -6813,7 +6310,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
         }
       }
       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)) {
@@ -6834,7 +6331,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
     }
     __pyx_v_filename = values[0];
     __pyx_v_mode = values[1];
-    __pyx_v_template = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[2]);
+    __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)values[2]);
     __pyx_v_referencenames = values[3];
     __pyx_v_referencelengths = values[4];
     __pyx_v_text = values[5];
@@ -6848,73 +6345,16 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7_open(PyObject *__pyx_v_se
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_template), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "template", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_6_open(((struct __pyx_obj_5pysam_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;
-}
-
-/* "pysam/csamtools.pyx":610
- *         return self.index != NULL
- * 
- *     def _open( self,             # <<<<<<<<<<<<<<
- *                filename,
- *                mode = None,
- */
-
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, struct __pyx_obj_5pysam_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;
-  bam_header_t *__pyx_t_14;
-  Py_ssize_t __pyx_t_15;
-  PyObject *(*__pyx_t_16)(PyObject *);
-  size_t __pyx_t_17;
-  int32_t __pyx_t_18;
-  long __pyx_t_19;
-  uint32_t __pyx_t_20;
-  const char* __pyx_t_21;
-  int __pyx_t_22;
-  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;}
 
-  /* "pysam/csamtools.pyx":630
+  /* "csamtools.pyx":630
  * 
  *         # read mode autodetection
  *         if mode is None:             # <<<<<<<<<<<<<<
@@ -6924,7 +6364,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
   __pyx_t_1 = (__pyx_v_mode == Py_None);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":631
+    /* "csamtools.pyx":631
  *         # read mode autodetection
  *         if mode is None:
  *             try:             # <<<<<<<<<<<<<<
@@ -6938,81 +6378,81 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
       __Pyx_XGOTREF(__pyx_t_4);
       /*try:*/ {
 
-        /* "pysam/csamtools.pyx":632
+        /* "csamtools.pyx":632
  *         if mode is None:
  *             try:
  *                 self._open(filename, 'rb', template=template,             # <<<<<<<<<<<<<<
  *                            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;}
 
-        /* "pysam/csamtools.pyx":633
+        /* "csamtools.pyx":633
  *             try:
  *                 self._open(filename, 'rb', template=template,
  *                            referencenames=referencenames,             # <<<<<<<<<<<<<<
  *                            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;}
 
-        /* "pysam/csamtools.pyx":634
+        /* "csamtools.pyx":634
  *                 self._open(filename, 'rb', template=template,
  *                            referencenames=referencenames,
  *                            referencelengths=referencelengths,             # <<<<<<<<<<<<<<
  *                            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;}
 
-        /* "pysam/csamtools.pyx":635
+        /* "csamtools.pyx":635
  *                            referencenames=referencenames,
  *                            referencelengths=referencelengths,
  *                            text=text, header=header, port=port,             # <<<<<<<<<<<<<<
  *                            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;}
 
-        /* "pysam/csamtools.pyx":636
+        /* "csamtools.pyx":636
  *                            referencelengths=referencelengths,
  *                            text=text, header=header, port=port,
  *                            check_header=check_header,             # <<<<<<<<<<<<<<
  *                            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;}
 
-        /* "pysam/csamtools.pyx":637
+        /* "csamtools.pyx":637
  *                            text=text, header=header, port=port,
  *                            check_header=check_header,
  *                            check_sq=check_sq)             # <<<<<<<<<<<<<<
  *                 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;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-        /* "pysam/csamtools.pyx":638
+        /* "csamtools.pyx":638
  *                            check_header=check_header,
  *                            check_sq=check_sq)
  *                 return             # <<<<<<<<<<<<<<
@@ -7021,25 +6461,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
         __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;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-      /* "pysam/csamtools.pyx":639
+      /* "csamtools.pyx":639
  *                            check_sq=check_sq)
  *                 return
  *             except ValueError, msg:             # <<<<<<<<<<<<<<
@@ -7048,8 +6488,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
       if (__pyx_t_9) {
-        __Pyx_AddTraceback("pysam.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;}
+        __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_L9_except_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_6);
@@ -7058,33 +6498,33 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
         __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:;
     }
 
-    /* "pysam/csamtools.pyx":642
+    /* "csamtools.pyx":642
  *                 pass
  * 
  *             self._open(filename, 'r', template=template,             # <<<<<<<<<<<<<<
  *                        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);
@@ -7095,7 +6535,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
     __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "pysam/csamtools.pyx":643
+    /* "csamtools.pyx":643
  * 
  *             self._open(filename, 'r', template=template,
  *                        referencenames=referencenames,             # <<<<<<<<<<<<<<
@@ -7104,7 +6544,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
     if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "pysam/csamtools.pyx":644
+    /* "csamtools.pyx":644
  *             self._open(filename, 'r', template=template,
  *                        referencenames=referencenames,
  *                        referencelengths=referencelengths,             # <<<<<<<<<<<<<<
@@ -7113,7 +6553,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
     if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "pysam/csamtools.pyx":645
+    /* "csamtools.pyx":645
  *                        referencenames=referencenames,
  *                        referencelengths=referencelengths,
  *                        text=text, header=header, port=port,             # <<<<<<<<<<<<<<
@@ -7124,7 +6564,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
     if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "pysam/csamtools.pyx":646
+    /* "csamtools.pyx":646
  *                        referencelengths=referencelengths,
  *                        text=text, header=header, port=port,
  *                        check_header=check_header,             # <<<<<<<<<<<<<<
@@ -7133,7 +6573,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
     if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__check_header), __pyx_v_check_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "pysam/csamtools.pyx":647
+    /* "csamtools.pyx":647
  *                        text=text, header=header, port=port,
  *                        check_header=check_header,
  *                        check_sq=check_sq)             # <<<<<<<<<<<<<<
@@ -7141,14 +6581,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  * 
  */
     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;
     __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "pysam/csamtools.pyx":648
+    /* "csamtools.pyx":648
  *                        check_header=check_header,
  *                        check_sq=check_sq)
  *             return             # <<<<<<<<<<<<<<
@@ -7158,11 +6598,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
     __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:;
 
-  /* "pysam/csamtools.pyx":650
+  /* "csamtools.pyx":650
  *             return
  * 
  *         assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode             # <<<<<<<<<<<<<<
@@ -7172,53 +6612,39 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
   #ifndef CYTHON_WITHOUT_ASSERTIONS
   __Pyx_INCREF(__pyx_v_mode);
   __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!((int)__pyx_t_1)) {
-    __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__w), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_11 = ((int)__pyx_t_10);
   } else {
     __pyx_t_11 = ((int)__pyx_t_1);
   }
   if (!__pyx_t_11) {
-    __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__rb), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__rb), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_10 = ((int)__pyx_t_1);
   } else {
     __pyx_t_10 = __pyx_t_11;
   }
   if (!__pyx_t_10) {
-    __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__wb), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_11 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__wb), Py_EQ); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_1 = ((int)__pyx_t_11);
   } else {
     __pyx_t_1 = __pyx_t_10;
   }
   if (!__pyx_t_1) {
-    __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__wh), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__wh), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_11 = ((int)__pyx_t_10);
   } else {
     __pyx_t_11 = __pyx_t_1;
   }
   if (!__pyx_t_11) {
-    __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__wbu), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__wbu), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_10 = ((int)__pyx_t_1);
   } else {
     __pyx_t_10 = __pyx_t_11;
   }
   if (!__pyx_t_10) {
-    __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__rU), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_11 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__rU), Py_EQ); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_1 = ((int)__pyx_t_11);
   } else {
     __pyx_t_1 = __pyx_t_10;
@@ -7233,35 +6659,35 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
   }
   #endif
 
-  /* "pysam/csamtools.pyx":655
+  /* "csamtools.pyx":655
  * 
  *         # close a previously opened file
  *         if self.samfile != NULL: self.close()             # <<<<<<<<<<<<<<
  *         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:;
 
-  /* "pysam/csamtools.pyx":656
+  /* "csamtools.pyx":656
  *         # close a previously opened file
  *         if self.samfile != NULL: self.close()
  *         self.samfile = NULL             # <<<<<<<<<<<<<<
  * 
  *         cdef bam_header_t * header_to_write
  */
-  __pyx_v_self->samfile = NULL;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
 
-  /* "pysam/csamtools.pyx":659
+  /* "csamtools.pyx":659
  * 
  *         cdef bam_header_t * header_to_write
  *         header_to_write = NULL             # <<<<<<<<<<<<<<
@@ -7270,34 +6696,34 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
   __pyx_v_header_to_write = NULL;
 
-  /* "pysam/csamtools.pyx":661
+  /* "csamtools.pyx":661
  *         header_to_write = NULL
  * 
  *         if self._filename != NULL: free(self._filename )             # <<<<<<<<<<<<<<
  *         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:;
 
-  /* "pysam/csamtools.pyx":662
+  /* "csamtools.pyx":662
  * 
  *         if self._filename != NULL: free(self._filename )
  *         filename = _my_encodeFilename(filename)             # <<<<<<<<<<<<<<
  *         cdef bytes bmode = mode.encode('ascii')
  *         #cdef char* cfilename
  */
-  __pyx_t_8 = ((PyObject *)__pyx_f_5pysam_9csamtools__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = ((PyObject *)__pyx_f_9csamtools__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_v_filename);
   __pyx_v_filename = __pyx_t_8;
   __pyx_t_8 = 0;
 
-  /* "pysam/csamtools.pyx":663
+  /* "csamtools.pyx":663
  *         if self._filename != NULL: free(self._filename )
  *         filename = _my_encodeFilename(filename)
  *         cdef bytes bmode = mode.encode('ascii')             # <<<<<<<<<<<<<<
@@ -7313,7 +6739,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
   __pyx_v_bmode = ((PyObject*)__pyx_t_5);
   __pyx_t_5 = 0;
 
-  /* "pysam/csamtools.pyx":666
+  /* "csamtools.pyx":666
  *         #cdef char* cfilename
  *         #cfilename = filename.encode(_FILENAME_ENCODING)
  *         self._filename = strdup(filename)             # <<<<<<<<<<<<<<
@@ -7321,9 +6747,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  * 
  */
   __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);
 
-  /* "pysam/csamtools.pyx":667
+  /* "csamtools.pyx":667
  *         #cfilename = filename.encode(_FILENAME_ENCODING)
  *         self._filename = strdup(filename)
  *         self.isstream = strcmp( filename, "-" ) == 0             # <<<<<<<<<<<<<<
@@ -7331,9 +6757,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *         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);
 
-  /* "pysam/csamtools.pyx":669
+  /* "csamtools.pyx":669
  *         self.isstream = strcmp( filename, "-" ) == 0
  * 
  *         self.isbam = len(mode) > 1 and mode[1] == 'b'             # <<<<<<<<<<<<<<
@@ -7341,26 +6767,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *         self.isremote = strncmp(filename,"http:",5) == 0 or \
  */
   __pyx_t_13 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = __Pyx_PyBool_FromLong((__pyx_t_13 > 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_13 > 1);
   if (__pyx_t_1) {
+    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__b), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__b), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = __pyx_t_7;
-    __pyx_t_7 = 0;
+    __pyx_t_11 = __pyx_t_10;
   } else {
-    __pyx_t_8 = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_11 = __pyx_t_1;
   }
-  __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_v_self->isbam = __pyx_t_9;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = __pyx_t_11;
 
-  /* "pysam/csamtools.pyx":671
+  /* "csamtools.pyx":671
  *         self.isbam = len(mode) > 1 and mode[1] == 'b'
  * 
  *         self.isremote = strncmp(filename,"http:",5) == 0 or \             # <<<<<<<<<<<<<<
@@ -7368,10 +6787,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  * 
  */
   __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = (strncmp(__pyx_t_12, __pyx_k_27, 5) == 0);
-  if (!__pyx_t_1) {
+  __pyx_t_11 = (strncmp(__pyx_t_12, __pyx_k_27, 5) == 0);
+  if (!__pyx_t_11) {
 
-    /* "pysam/csamtools.pyx":672
+    /* "csamtools.pyx":672
  * 
  *         self.isremote = strncmp(filename,"http:",5) == 0 or \
  *             strncmp(filename,"ftp:",4) == 0             # <<<<<<<<<<<<<<
@@ -7379,22 +6798,22 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *         cdef char * ctext
  */
     __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_10 = (strncmp(__pyx_t_12, __pyx_k_28, 4) == 0);
-    __pyx_t_11 = __pyx_t_10;
+    __pyx_t_1 = (strncmp(__pyx_t_12, __pyx_k_28, 4) == 0);
+    __pyx_t_10 = __pyx_t_1;
   } else {
-    __pyx_t_11 = __pyx_t_1;
+    __pyx_t_10 = __pyx_t_11;
   }
 
-  /* "pysam/csamtools.pyx":671
+  /* "csamtools.pyx":671
  *         self.isbam = len(mode) > 1 and mode[1] == 'b'
  * 
  *         self.isremote = strncmp(filename,"http:",5) == 0 or \             # <<<<<<<<<<<<<<
  *             strncmp(filename,"ftp:",4) == 0
  * 
  */
-  __pyx_v_self->isremote = __pyx_t_11;
+  ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote = __pyx_t_10;
 
-  /* "pysam/csamtools.pyx":675
+  /* "csamtools.pyx":675
  * 
  *         cdef char * ctext
  *         ctext = NULL             # <<<<<<<<<<<<<<
@@ -7403,66 +6822,63 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
   __pyx_v_ctext = NULL;
 
-  /* "pysam/csamtools.pyx":677
+  /* "csamtools.pyx":677
  *         ctext = NULL
  * 
  *         if mode[0] == 'w':             # <<<<<<<<<<<<<<
  *             # open file for writing
  * 
  */
-  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_5 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__w), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_11) {
+  if (__pyx_t_10) {
 
-    /* "pysam/csamtools.pyx":681
+    /* "csamtools.pyx":681
  * 
  *             # header structure (used for writing)
  *             if template:             # <<<<<<<<<<<<<<
  *                 # copy header from another file
  *                 header_to_write = template.samfile.header
  */
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (__pyx_t_11) {
+    __pyx_t_10 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__pyx_t_10) {
 
-      /* "pysam/csamtools.pyx":683
+      /* "csamtools.pyx":683
  *             if template:
  *                 # copy header from another file
  *                 header_to_write = template.samfile.header             # <<<<<<<<<<<<<<
  * 
  *             elif header:
  */
-      __pyx_t_14 = __pyx_v_template->samfile->header;
-      __pyx_v_header_to_write = __pyx_t_14;
-      goto __pyx_L17;
+      __pyx_v_header_to_write = __pyx_v_template->samfile->header;
+      goto __pyx_L20;
     }
 
-    /* "pysam/csamtools.pyx":685
+    /* "csamtools.pyx":685
  *                 header_to_write = template.samfile.header
  * 
  *             elif header:             # <<<<<<<<<<<<<<
  *                 header_to_write = self._buildHeader( header )
  * 
  */
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_header); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (__pyx_t_11) {
+    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_header); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__pyx_t_10) {
 
-      /* "pysam/csamtools.pyx":686
+      /* "csamtools.pyx":686
  * 
  *             elif header:
  *                 header_to_write = self._buildHeader( header )             # <<<<<<<<<<<<<<
  * 
  *             else:
  */
-      __pyx_v_header_to_write = ((struct __pyx_vtabstruct_5pysam_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*/ {
 
-      /* "pysam/csamtools.pyx":690
+      /* "csamtools.pyx":690
  *             else:
  *                 # build header from a target names and lengths
  *                 assert referencenames and referencelengths, "either supply options `template`, `header` or  both `referencenames` and `referencelengths` for writing"             # <<<<<<<<<<<<<<
@@ -7470,20 +6886,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  * 
  */
       #ifndef CYTHON_WITHOUT_ASSERTIONS
-      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_referencenames); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (__pyx_t_11) {
-        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_referencelengths); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_10 = __pyx_t_1;
+      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_referencenames); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__pyx_t_10) {
+        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_referencelengths); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = __pyx_t_11;
       } else {
-        __pyx_t_10 = __pyx_t_11;
+        __pyx_t_1 = __pyx_t_10;
       }
-      if (unlikely(!__pyx_t_10)) {
+      if (unlikely(!__pyx_t_1)) {
         PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_29));
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       #endif
 
-      /* "pysam/csamtools.pyx":691
+      /* "csamtools.pyx":691
  *                 # build header from a target names and lengths
  *                 assert referencenames and referencelengths, "either supply options `template`, `header` or  both `referencenames` and `referencelengths` for writing"
  *                 assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences"             # <<<<<<<<<<<<<<
@@ -7492,14 +6908,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
       #ifndef CYTHON_WITHOUT_ASSERTIONS
       __pyx_t_13 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_15 = PyObject_Length(__pyx_v_referencelengths); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (unlikely(!(__pyx_t_13 == __pyx_t_15))) {
+      __pyx_t_14 = PyObject_Length(__pyx_v_referencelengths); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(!(__pyx_t_13 == __pyx_t_14))) {
         PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_30));
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       #endif
 
-      /* "pysam/csamtools.pyx":694
+      /* "csamtools.pyx":694
  * 
  *                 # allocate and fill header
  *                 referencenames = [ _force_bytes(ref) for ref in referencenames ]             # <<<<<<<<<<<<<<
@@ -7507,32 +6923,24 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *                 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_15 = 0;
-        __pyx_t_16 = NULL;
+        __pyx_t_8 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_8); __pyx_t_14 = 0;
+        __pyx_t_15 = NULL;
       } else {
-        __pyx_t_15 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_16 = Py_TYPE(__pyx_t_8)->tp_iternext;
+        __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_8)) {
-          if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_8)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_15); __Pyx_INCREF(__pyx_t_7); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_8)) {
-          if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_15); __Pyx_INCREF(__pyx_t_7); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+        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 (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 {
-          __pyx_t_7 = __pyx_t_16(__pyx_t_8);
+          __pyx_t_7 = __pyx_t_15(__pyx_t_8);
           if (unlikely(!__pyx_t_7)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -7545,20 +6953,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
         __Pyx_XDECREF(__pyx_v_ref);
         __pyx_v_ref = __pyx_t_7;
         __pyx_t_7 = 0;
-        __pyx_t_7 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_bytes(__pyx_v_ref)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_ref)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        if (unlikely(__Pyx_PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       }
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_8 = ((PyObject *)__pyx_t_5);
-      __Pyx_INCREF(__pyx_t_8);
-      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __Pyx_INCREF(((PyObject *)__pyx_t_5));
       __Pyx_DECREF(__pyx_v_referencenames);
-      __pyx_v_referencenames = __pyx_t_8;
-      __pyx_t_8 = 0;
+      __pyx_v_referencenames = ((PyObject *)__pyx_t_5);
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
 
-      /* "pysam/csamtools.pyx":695
+      /* "csamtools.pyx":695
  *                 # allocate and fill header
  *                 referencenames = [ _force_bytes(ref) for ref in referencenames ]
  *                 header_to_write = bam_header_init()             # <<<<<<<<<<<<<<
@@ -7567,17 +6973,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
       __pyx_v_header_to_write = bam_header_init();
 
-      /* "pysam/csamtools.pyx":696
+      /* "csamtools.pyx":696
  *                 referencenames = [ _force_bytes(ref) for ref in referencenames ]
  *                 header_to_write = bam_header_init()
  *                 header_to_write.n_targets = len(referencenames)             # <<<<<<<<<<<<<<
  *                 n = 0
  *                 for x in referencenames: n += len(x) + 1
  */
-      __pyx_t_15 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_header_to_write->n_targets = __pyx_t_15;
+      __pyx_t_14 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_header_to_write->n_targets = __pyx_t_14;
 
-      /* "pysam/csamtools.pyx":697
+      /* "csamtools.pyx":697
  *                 header_to_write = bam_header_init()
  *                 header_to_write.n_targets = len(referencenames)
  *                 n = 0             # <<<<<<<<<<<<<<
@@ -7587,7 +6993,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
       __Pyx_INCREF(__pyx_int_0);
       __pyx_v_n = __pyx_int_0;
 
-      /* "pysam/csamtools.pyx":698
+      /* "csamtools.pyx":698
  *                 header_to_write.n_targets = len(referencenames)
  *                 n = 0
  *                 for x in referencenames: n += len(x) + 1             # <<<<<<<<<<<<<<
@@ -7595,291 +7001,284 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  */
       if (PyList_CheckExact(__pyx_v_referencenames) || PyTuple_CheckExact(__pyx_v_referencenames)) {
-        __pyx_t_8 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_8); __pyx_t_15 = 0;
-        __pyx_t_16 = NULL;
+        __pyx_t_5 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_5); __pyx_t_14 = 0;
+        __pyx_t_15 = NULL;
       } else {
-        __pyx_t_15 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_16 = Py_TYPE(__pyx_t_8)->tp_iternext;
+        __pyx_t_14 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_15 = Py_TYPE(__pyx_t_5)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_8)) {
-          if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_8)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_15); __Pyx_INCREF(__pyx_t_5); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_8)) {
-          if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_15); __Pyx_INCREF(__pyx_t_5); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+        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 (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 {
-          __pyx_t_5 = __pyx_t_16(__pyx_t_8);
-          if (unlikely(!__pyx_t_5)) {
+          __pyx_t_8 = __pyx_t_15(__pyx_t_5);
+          if (unlikely(!__pyx_t_8)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
               else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             }
             break;
           }
-          __Pyx_GOTREF(__pyx_t_5);
+          __Pyx_GOTREF(__pyx_t_8);
         }
         __Pyx_XDECREF(__pyx_v_x);
-        __pyx_v_x = __pyx_t_5;
-        __pyx_t_5 = 0;
+        __pyx_v_x = __pyx_t_8;
+        __pyx_t_8 = 0;
         __pyx_t_13 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_13 + 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_n, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyInt_FromSsize_t((__pyx_t_13 + 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_n, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_v_n);
         __pyx_v_n = __pyx_t_7;
         __pyx_t_7 = 0;
       }
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-      /* "pysam/csamtools.pyx":699
+      /* "csamtools.pyx":699
  *                 n = 0
  *                 for x in referencenames: n += len(x) + 1
  *                 header_to_write.target_name = <char**>calloc(n, sizeof(char*))             # <<<<<<<<<<<<<<
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  *                 for x from 0 <= x < header_to_write.n_targets:
  */
-      __pyx_t_17 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_17 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_header_to_write->target_name = ((char **)calloc(__pyx_t_17, (sizeof(char *))));
+      __pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_header_to_write->target_name = ((char **)calloc(__pyx_t_16, (sizeof(char *))));
 
-      /* "pysam/csamtools.pyx":700
+      /* "csamtools.pyx":700
  *                 for x in referencenames: n += len(x) + 1
  *                 header_to_write.target_name = <char**>calloc(n, sizeof(char*))
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))             # <<<<<<<<<<<<<<
  *                 for x from 0 <= x < header_to_write.n_targets:
  *                     header_to_write.target_len[x] = referencelengths[x]
  */
-      __pyx_t_17 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_17 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_header_to_write->target_len = ((uint32_t *)calloc(__pyx_t_17, (sizeof(uint32_t))));
+      __pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_header_to_write->target_len = ((uint32_t *)calloc(__pyx_t_16, (sizeof(uint32_t))));
 
-      /* "pysam/csamtools.pyx":701
+      /* "csamtools.pyx":701
  *                 header_to_write.target_name = <char**>calloc(n, sizeof(char*))
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  *                 for x from 0 <= x < header_to_write.n_targets:             # <<<<<<<<<<<<<<
  *                     header_to_write.target_len[x] = referencelengths[x]
  *                     name = referencenames[x]
  */
-      __pyx_t_18 = __pyx_v_header_to_write->n_targets;
-      for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19++) {
-        __pyx_t_8 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_17 = __pyx_v_header_to_write->n_targets;
+      for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18++) {
+        __pyx_t_5 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_XDECREF(__pyx_v_x);
-        __pyx_v_x = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_x = __pyx_t_5;
+        __pyx_t_5 = 0;
 
-        /* "pysam/csamtools.pyx":702
+        /* "csamtools.pyx":702
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  *                 for x from 0 <= x < header_to_write.n_targets:
  *                     header_to_write.target_len[x] = referencelengths[x]             # <<<<<<<<<<<<<<
  *                     name = referencenames[x]
  *                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
  */
-        __pyx_t_8 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_20 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_8); if (unlikely((__pyx_t_20 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        (__pyx_v_header_to_write->target_len[__pyx_t_15]) = __pyx_t_20;
+        __pyx_t_5 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_19 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_19 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        (__pyx_v_header_to_write->target_len[__pyx_t_14]) = __pyx_t_19;
 
-        /* "pysam/csamtools.pyx":703
+        /* "csamtools.pyx":703
  *                 for x from 0 <= x < header_to_write.n_targets:
  *                     header_to_write.target_len[x] = referencelengths[x]
  *                     name = referencenames[x]             # <<<<<<<<<<<<<<
  *                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
  *                     strncpy( header_to_write.target_name[x], name, len(name) )
  */
-        __pyx_t_8 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_5 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_XDECREF(__pyx_v_name);
-        __pyx_v_name = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_name = __pyx_t_5;
+        __pyx_t_5 = 0;
 
-        /* "pysam/csamtools.pyx":704
+        /* "csamtools.pyx":704
  *                     header_to_write.target_len[x] = referencelengths[x]
  *                     name = referencenames[x]
  *                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))             # <<<<<<<<<<<<<<
  *                     strncpy( header_to_write.target_name[x], name, len(name) )
  * 
  */
-        __pyx_t_15 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_14 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        (__pyx_v_header_to_write->target_name[__pyx_t_13]) = ((char *)calloc((__pyx_t_15 + 1), (sizeof(char))));
+        (__pyx_v_header_to_write->target_name[__pyx_t_13]) = ((char *)calloc((__pyx_t_14 + 1), (sizeof(char))));
 
-        /* "pysam/csamtools.pyx":705
+        /* "csamtools.pyx":705
  *                     name = referencenames[x]
  *                     header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
  *                     strncpy( header_to_write.target_name[x], name, len(name) )             # <<<<<<<<<<<<<<
  * 
  *                 # Optionally, if there is no text, add a SAM compatible header to output
  */
-        __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_12 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_13 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        strncpy((__pyx_v_header_to_write->target_name[__pyx_t_15]), __pyx_t_12, __pyx_t_13);
-        __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        strncpy((__pyx_v_header_to_write->target_name[__pyx_t_14]), __pyx_t_12, __pyx_t_13);
+        __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
 
-      /* "pysam/csamtools.pyx":701
+      /* "csamtools.pyx":701
  *                 header_to_write.target_name = <char**>calloc(n, sizeof(char*))
  *                 header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
  *                 for x from 0 <= x < header_to_write.n_targets:             # <<<<<<<<<<<<<<
  *                     header_to_write.target_len[x] = referencelengths[x]
  *                     name = referencenames[x]
  */
-      __pyx_t_8 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_5 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __Pyx_XDECREF(__pyx_v_x);
-      __pyx_v_x = __pyx_t_8;
-      __pyx_t_8 = 0;
+      __pyx_v_x = __pyx_t_5;
+      __pyx_t_5 = 0;
 
-      /* "pysam/csamtools.pyx":709
+      /* "csamtools.pyx":709
  *                 # Optionally, if there is no text, add a SAM compatible header to output
  *                 # file.
  *                 if text is None and add_sq_text:             # <<<<<<<<<<<<<<
  *                     text = []
  *                     for x from 0 <= x < header_to_write.n_targets:
  */
-      __pyx_t_10 = (__pyx_v_text == Py_None);
-      if (__pyx_t_10) {
-        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_add_sq_text); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_1 = __pyx_t_11;
+      __pyx_t_1 = (__pyx_v_text == Py_None);
+      if (__pyx_t_1) {
+        __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_add_sq_text); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __pyx_t_10;
       } else {
-        __pyx_t_1 = __pyx_t_10;
+        __pyx_t_11 = __pyx_t_1;
       }
-      if (__pyx_t_1) {
+      if (__pyx_t_11) {
 
-        /* "pysam/csamtools.pyx":710
+        /* "csamtools.pyx":710
  *                 # file.
  *                 if text is None and add_sq_text:
  *                     text = []             # <<<<<<<<<<<<<<
  *                     for x from 0 <= x < header_to_write.n_targets:
  *                         text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
  */
-        __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __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(((PyObject *)__pyx_t_5));
         __Pyx_DECREF(__pyx_v_text);
-        __pyx_v_text = ((PyObject *)__pyx_t_8);
-        __pyx_t_8 = 0;
+        __pyx_v_text = ((PyObject *)__pyx_t_5);
+        __pyx_t_5 = 0;
 
-        /* "pysam/csamtools.pyx":711
+        /* "csamtools.pyx":711
  *                 if text is None and add_sq_text:
  *                     text = []
  *                     for x from 0 <= x < header_to_write.n_targets:             # <<<<<<<<<<<<<<
  *                         text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
  *                     text = ''.join(text)
  */
-        __pyx_t_18 = __pyx_v_header_to_write->n_targets;
-        for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19++) {
-          __pyx_t_8 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_17 = __pyx_v_header_to_write->n_targets;
+        for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18++) {
+          __pyx_t_5 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_5);
           __Pyx_XDECREF(__pyx_v_x);
-          __pyx_v_x = __pyx_t_8;
-          __pyx_t_8 = 0;
+          __pyx_v_x = __pyx_t_5;
+          __pyx_t_5 = 0;
 
-          /* "pysam/csamtools.pyx":712
+          /* "csamtools.pyx":712
  *                     text = []
  *                     for x from 0 <= x < header_to_write.n_targets:
  *                         text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )             # <<<<<<<<<<<<<<
  *                     text = ''.join(text)
  * 
  */
-          __pyx_t_8 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
+          __pyx_t_5 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_5);
           __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_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_5);
-          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
-          __Pyx_GIVEREF(__pyx_t_8);
-          PyTuple_SET_ITEM(__pyx_t_5, 1, __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(((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);
           __Pyx_GIVEREF(__pyx_t_7);
-          __pyx_t_8 = 0;
+          __pyx_t_5 = 0;
           __pyx_t_7 = 0;
-          __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-          __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_text, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_5);
+          __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+          __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_text, ((PyObject *)__pyx_t_7)); 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_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-          __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
 
-        /* "pysam/csamtools.pyx":711
+        /* "csamtools.pyx":711
  *                 if text is None and add_sq_text:
  *                     text = []
  *                     for x from 0 <= x < header_to_write.n_targets:             # <<<<<<<<<<<<<<
  *                         text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
  *                     text = ''.join(text)
  */
-        __pyx_t_5 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_8 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_XDECREF(__pyx_v_x);
-        __pyx_v_x = __pyx_t_5;
-        __pyx_t_5 = 0;
+        __pyx_v_x = __pyx_t_8;
+        __pyx_t_8 = 0;
 
-        /* "pysam/csamtools.pyx":713
+        /* "csamtools.pyx":713
  *                     for x from 0 <= x < header_to_write.n_targets:
  *                         text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
  *                     text = ''.join(text)             # <<<<<<<<<<<<<<
  * 
  *                 if text != None:
  */
-        __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_16), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
+        __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);
-        __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_5 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_v_text);
-        __pyx_v_text = __pyx_t_8;
-        __pyx_t_8 = 0;
-        goto __pyx_L24;
+        __pyx_v_text = __pyx_t_5;
+        __pyx_t_5 = 0;
+        goto __pyx_L27;
       }
-      __pyx_L24:;
+      __pyx_L27:;
 
-      /* "pysam/csamtools.pyx":715
+      /* "csamtools.pyx":715
  *                     text = ''.join(text)
  * 
  *                 if text != None:             # <<<<<<<<<<<<<<
  *                     # copy without \0
  *                     text = _force_bytes(text)
  */
-      __pyx_t_8 = PyObject_RichCompare(__pyx_v_text, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      if (__pyx_t_1) {
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_text, Py_None, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_11) {
 
-        /* "pysam/csamtools.pyx":717
+        /* "csamtools.pyx":717
  *                 if text != None:
  *                     # copy without \0
  *                     text = _force_bytes(text)             # <<<<<<<<<<<<<<
  *                     ctext = text
  *                     header_to_write.l_text = strlen(ctext)
  */
-        __pyx_t_8 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_bytes(__pyx_v_text)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_5 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_text)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_v_text);
-        __pyx_v_text = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_text = __pyx_t_5;
+        __pyx_t_5 = 0;
 
-        /* "pysam/csamtools.pyx":718
+        /* "csamtools.pyx":718
  *                     # copy without \0
  *                     text = _force_bytes(text)
  *                     ctext = text             # <<<<<<<<<<<<<<
@@ -7889,7 +7288,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
         __pyx_t_12 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_v_ctext = __pyx_t_12;
 
-        /* "pysam/csamtools.pyx":719
+        /* "csamtools.pyx":719
  *                     text = _force_bytes(text)
  *                     ctext = text
  *                     header_to_write.l_text = strlen(ctext)             # <<<<<<<<<<<<<<
@@ -7898,7 +7297,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
         __pyx_v_header_to_write->l_text = strlen(__pyx_v_ctext);
 
-        /* "pysam/csamtools.pyx":720
+        /* "csamtools.pyx":720
  *                     ctext = text
  *                     header_to_write.l_text = strlen(ctext)
  *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )             # <<<<<<<<<<<<<<
@@ -7907,7 +7306,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
         __pyx_v_header_to_write->text = ((char *)calloc(strlen(__pyx_v_ctext), (sizeof(char))));
 
-        /* "pysam/csamtools.pyx":721
+        /* "csamtools.pyx":721
  *                     header_to_write.l_text = strlen(ctext)
  *                     header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
  *                     memcpy( header_to_write.text, ctext, strlen(ctext) )             # <<<<<<<<<<<<<<
@@ -7915,11 +7314,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *                 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:;
 
-      /* "pysam/csamtools.pyx":723
+      /* "csamtools.pyx":723
  *                     memcpy( header_to_write.text, ctext, strlen(ctext) )
  * 
  *                 header_to_write.hash = NULL             # <<<<<<<<<<<<<<
@@ -7928,7 +7327,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
       __pyx_v_header_to_write->hash = NULL;
 
-      /* "pysam/csamtools.pyx":724
+      /* "csamtools.pyx":724
  * 
  *                 header_to_write.hash = NULL
  *                 header_to_write.rg2lib = NULL             # <<<<<<<<<<<<<<
@@ -7937,35 +7336,35 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
       __pyx_v_header_to_write->rg2lib = NULL;
     }
-    __pyx_L17:;
+    __pyx_L20:;
 
-    /* "pysam/csamtools.pyx":728
+    /* "csamtools.pyx":728
  *             # open file. Header gets written to file at the same time for bam files
  *             # and sam files (in the latter case, the mode needs to be wh)
  *             store = StderrStore()             # <<<<<<<<<<<<<<
  *             self.samfile = samopen( filename, bmode, header_to_write )
  *             store.release()
  */
-    __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __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 = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_v_store = __pyx_t_7;
     __pyx_t_7 = 0;
 
-    /* "pysam/csamtools.pyx":729
+    /* "csamtools.pyx":729
  *             # and sam files (in the latter case, the mode needs to be wh)
  *             store = StderrStore()
  *             self.samfile = samopen( filename, bmode, header_to_write )             # <<<<<<<<<<<<<<
  *             store.release()
  * 
  */
-    __pyx_t_21 = PyBytes_AsString(__pyx_v_filename); if (unlikely((__pyx_t_21 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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_21, __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);
 
-    /* "pysam/csamtools.pyx":730
+    /* "csamtools.pyx":730
  *             store = StderrStore()
  *             self.samfile = samopen( filename, bmode, header_to_write )
  *             store.release()             # <<<<<<<<<<<<<<
@@ -7974,29 +7373,29 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
     __pyx_t_7 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __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 = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "pysam/csamtools.pyx":733
+    /* "csamtools.pyx":733
  * 
  *             # bam_header_destroy takes care of cleaning up of all the members
  *             if not template and header_to_write != NULL:             # <<<<<<<<<<<<<<
  *                 bam_header_destroy( header_to_write )
  * 
  */
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_10 = (!__pyx_t_1);
-    if (__pyx_t_10) {
-      __pyx_t_1 = (__pyx_v_header_to_write != NULL);
-      __pyx_t_11 = __pyx_t_1;
+    __pyx_t_11 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = (!__pyx_t_11);
+    if (__pyx_t_1) {
+      __pyx_t_11 = (__pyx_v_header_to_write != NULL);
+      __pyx_t_10 = __pyx_t_11;
     } else {
-      __pyx_t_11 = __pyx_t_10;
+      __pyx_t_10 = __pyx_t_1;
     }
-    if (__pyx_t_11) {
+    if (__pyx_t_10) {
 
-      /* "pysam/csamtools.pyx":734
+      /* "csamtools.pyx":734
  *             # bam_header_destroy takes care of cleaning up of all the members
  *             if not template and header_to_write != NULL:
  *                 bam_header_destroy( header_to_write )             # <<<<<<<<<<<<<<
@@ -8004,28 +7403,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *         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;
   }
 
-  /* "pysam/csamtools.pyx":736
+  /* "csamtools.pyx":736
  *                 bam_header_destroy( header_to_write )
  * 
  *         elif mode[0] == "r":             # <<<<<<<<<<<<<<
  *             # open file for reading
  *             if strncmp( filename, "-", 1) != 0 and \
  */
-  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (__pyx_t_11) {
+  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  if (__pyx_t_10) {
 
-    /* "pysam/csamtools.pyx":738
+    /* "csamtools.pyx":738
  *         elif mode[0] == "r":
  *             # open file for reading
  *             if strncmp( filename, "-", 1) != 0 and \             # <<<<<<<<<<<<<<
@@ -8033,321 +7430,319 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *                     not os.path.exists( filename ):
  */
     __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_11 = (strncmp(__pyx_t_12, __pyx_k_26, 1) != 0);
-    if (__pyx_t_11) {
+    __pyx_t_10 = (strncmp(__pyx_t_12, __pyx_k_26, 1) != 0);
+    if (__pyx_t_10) {
 
-      /* "pysam/csamtools.pyx":739
+      /* "csamtools.pyx":739
  *             # open file for reading
  *             if strncmp( filename, "-", 1) != 0 and \
  *                     not self.isremote and \             # <<<<<<<<<<<<<<
  *                     not os.path.exists( filename ):
  *                 raise IOError( "file `%s` not found" % filename)
  */
-      __pyx_t_10 = (!__pyx_v_self->isremote);
-      if (__pyx_t_10) {
+      __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
+      if (__pyx_t_1) {
 
-        /* "pysam/csamtools.pyx":740
+        /* "csamtools.pyx":740
  *             if strncmp( filename, "-", 1) != 0 and \
  *                     not self.isremote and \
  *                     not os.path.exists( filename ):             # <<<<<<<<<<<<<<
  *                 raise IOError( "file `%s` not found" % filename)
  * 
  */
-        __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__path); 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_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__path); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__exists); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__exists); 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_DECREF(__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 = 740; __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 = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_filename);
-        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_filename);
+        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filename);
         __Pyx_GIVEREF(__pyx_v_filename);
-        __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_22 = (!__pyx_t_1);
-        __pyx_t_1 = __pyx_t_22;
+        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_21 = (!__pyx_t_11);
+        __pyx_t_11 = __pyx_t_21;
       } else {
-        __pyx_t_1 = __pyx_t_10;
+        __pyx_t_11 = __pyx_t_1;
       }
-      __pyx_t_10 = __pyx_t_1;
+      __pyx_t_1 = __pyx_t_11;
     } else {
-      __pyx_t_10 = __pyx_t_11;
+      __pyx_t_1 = __pyx_t_10;
     }
-    if (__pyx_t_10) {
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":741
+      /* "csamtools.pyx":741
  *                     not self.isremote and \
  *                     not os.path.exists( filename ):
  *                 raise IOError( "file `%s` not found" % filename)             # <<<<<<<<<<<<<<
  * 
  *             # try to detect errors
  */
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), __pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __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(((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;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_5));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-      __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+      __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:;
 
-    /* "pysam/csamtools.pyx":744
+    /* "csamtools.pyx":744
  * 
  *             # try to detect errors
  *             self.samfile = samopen( filename, bmode, NULL )             # <<<<<<<<<<<<<<
  *             if self.samfile == NULL:
  *                 raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
  */
-    __pyx_t_21 = PyBytes_AsString(__pyx_v_filename); if (unlikely((__pyx_t_21 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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_21, __pyx_t_12, NULL);
+    ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_t_20, __pyx_t_12, NULL);
 
-    /* "pysam/csamtools.pyx":745
+    /* "csamtools.pyx":745
  *             # try to detect errors
  *             self.samfile = samopen( filename, bmode, NULL )
  *             if self.samfile == NULL:             # <<<<<<<<<<<<<<
  *                 raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
  * 
  */
-    __pyx_t_10 = (__pyx_v_self->samfile == NULL);
-    if (__pyx_t_10) {
+    __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":746
+      /* "csamtools.pyx":746
  *             self.samfile = samopen( filename, bmode, NULL )
  *             if self.samfile == NULL:
  *                 raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)             # <<<<<<<<<<<<<<
  * 
  *             # bam files require a valid header
  */
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __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(((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;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_5));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-      __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+      __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:;
 
-    /* "pysam/csamtools.pyx":749
+    /* "csamtools.pyx":749
  * 
  *             # bam files require a valid header
  *             if self.isbam:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":750
+      /* "csamtools.pyx":750
  *             # bam files require a valid header
  *             if self.isbam:
  *                 if self.samfile.header == NULL:             # <<<<<<<<<<<<<<
  *                     raise ValueError( "file does not have valid header (mode='%s') - is it BAM format?" % mode )
  *             else:
  */
-      __pyx_t_10 = (__pyx_v_self->samfile->header == NULL);
-      if (__pyx_t_10) {
+      __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL);
+      if (__pyx_t_1) {
 
-        /* "pysam/csamtools.pyx":751
+        /* "csamtools.pyx":751
  *             if self.isbam:
  *                 if self.samfile.header == NULL:
  *                     raise ValueError( "file does not have valid header (mode='%s') - is it BAM format?" % mode )             # <<<<<<<<<<<<<<
  *             else:
  *                 # in sam files it is optional (samfile full of unmapped reads)
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __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(((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;
+        __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_5));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-        __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+        __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*/ {
 
-      /* "pysam/csamtools.pyx":754
+      /* "csamtools.pyx":754
  *             else:
  *                 # in sam files it is optional (samfile full of unmapped reads)
  *                 if check_header and self.samfile.header == NULL:             # <<<<<<<<<<<<<<
  *                     raise ValueError( "file does not have valid header (mode='%s') - is it SAM format?" % mode )
  * 
  */
-      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_check_header); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (__pyx_t_10) {
-        __pyx_t_11 = (__pyx_v_self->samfile->header == NULL);
-        __pyx_t_1 = __pyx_t_11;
+      __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 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL);
+        __pyx_t_11 = __pyx_t_10;
       } else {
-        __pyx_t_1 = __pyx_t_10;
+        __pyx_t_11 = __pyx_t_1;
       }
-      if (__pyx_t_1) {
+      if (__pyx_t_11) {
 
-        /* "pysam/csamtools.pyx":755
+        /* "csamtools.pyx":755
  *                 # in sam files it is optional (samfile full of unmapped reads)
  *                 if check_header and self.samfile.header == NULL:
  *                     raise ValueError( "file does not have valid header (mode='%s') - is it SAM format?" % mode )             # <<<<<<<<<<<<<<
  * 
  *             # disabled for autodetection to work
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __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(((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;
+        __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_5));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-        __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+        __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:;
 
-    /* "pysam/csamtools.pyx":759
+    /* "csamtools.pyx":759
  *             # disabled for autodetection to work
  *             # needs to be disabled so that reading from sam-files without headers works
  *             if check_sq and self.samfile.header.n_targets == 0:             # <<<<<<<<<<<<<<
  *                 raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
  * 
  */
-    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_check_sq); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (__pyx_t_1) {
-      __pyx_t_10 = (__pyx_v_self->samfile->header->n_targets == 0);
-      __pyx_t_11 = __pyx_t_10;
+    __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 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
+      __pyx_t_10 = __pyx_t_1;
     } else {
-      __pyx_t_11 = __pyx_t_1;
+      __pyx_t_10 = __pyx_t_11;
     }
-    if (__pyx_t_11) {
+    if (__pyx_t_10) {
 
-      /* "pysam/csamtools.pyx":760
+      /* "csamtools.pyx":760
  *             # needs to be disabled so that reading from sam-files without headers works
  *             if check_sq and self.samfile.header.n_targets == 0:
  *                 raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)             # <<<<<<<<<<<<<<
  * 
  *         if self.samfile == NULL:
  */
-      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __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(((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;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), 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);
-      PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_5));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-      __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+      __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:;
 
-  /* "pysam/csamtools.pyx":762
+  /* "csamtools.pyx":762
  *                 raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
  * 
  *         if self.samfile == NULL:             # <<<<<<<<<<<<<<
  *             raise IOError("could not open file `%s`" % filename )
  * 
  */
-  __pyx_t_11 = (__pyx_v_self->samfile == NULL);
-  if (__pyx_t_11) {
+  __pyx_t_10 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
+  if (__pyx_t_10) {
 
-    /* "pysam/csamtools.pyx":763
+    /* "csamtools.pyx":763
  * 
  *         if self.samfile == NULL:
  *             raise IOError("could not open file `%s`" % filename )             # <<<<<<<<<<<<<<
  * 
  *         # check for index and open if present
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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(((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;
+    __pyx_t_8 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+    __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:;
 
-  /* "pysam/csamtools.pyx":766
+  /* "csamtools.pyx":766
  * 
  *         # check for index and open if present
  *         if mode[0] == "r" and self.isbam:             # <<<<<<<<<<<<<<
  * 
  *             if not self.isremote:
  */
-  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __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_11) {
-    __pyx_t_1 = __pyx_v_self->isbam;
+  if (__pyx_t_10) {
+    __pyx_t_11 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam;
   } else {
-    __pyx_t_1 = __pyx_t_11;
+    __pyx_t_11 = __pyx_t_10;
   }
-  if (__pyx_t_1) {
+  if (__pyx_t_11) {
 
-    /* "pysam/csamtools.pyx":768
+    /* "csamtools.pyx":768
  *         if mode[0] == "r" and self.isbam:
  * 
  *             if not self.isremote:             # <<<<<<<<<<<<<<
  *                 if not os.path.exists(filename + b".bai"):
  *                     self.index = NULL
  */
-    __pyx_t_1 = (!__pyx_v_self->isremote);
-    if (__pyx_t_1) {
+    __pyx_t_11 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
+    if (__pyx_t_11) {
 
-      /* "pysam/csamtools.pyx":769
+      /* "csamtools.pyx":769
  * 
  *             if not self.isremote:
  *                 if not os.path.exists(filename + b".bai"):             # <<<<<<<<<<<<<<
@@ -8356,41 +7751,41 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  */
       __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_5 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__path); 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_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__path); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_8 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__exists); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__exists); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_b_37)); 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_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __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(((PyObject *)__pyx_t_5));
+      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
+      __Pyx_GIVEREF(__pyx_t_7);
+      __pyx_t_7 = 0;
+      __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_5), NULL); 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);
-      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
-      __Pyx_GIVEREF(__pyx_t_5);
-      __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_11 = (!__pyx_t_1);
-      if (__pyx_t_11) {
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_10 = (!__pyx_t_11);
+      if (__pyx_t_10) {
 
-        /* "pysam/csamtools.pyx":770
+        /* "csamtools.pyx":770
  *             if not self.isremote:
  *                 if not os.path.exists(filename + b".bai"):
  *                     self.index = NULL             # <<<<<<<<<<<<<<
  *                 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*/ {
 
-        /* "pysam/csamtools.pyx":773
+        /* "csamtools.pyx":773
  *                 else:
  *                     # returns NULL if there is no index or index could not be opened
  *                     self.index = bam_index_load(filename)             # <<<<<<<<<<<<<<
@@ -8398,48 +7793,48 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *                         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);
 
-        /* "pysam/csamtools.pyx":774
+        /* "csamtools.pyx":774
  *                     # returns NULL if there is no index or index could not be opened
  *                     self.index = bam_index_load(filename)
  *                     if self.index == NULL:             # <<<<<<<<<<<<<<
  *                         raise IOError("error while opening index `%s` " % filename )
  *             else:
  */
-        __pyx_t_11 = (__pyx_v_self->index == NULL);
-        if (__pyx_t_11) {
+        __pyx_t_10 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
+        if (__pyx_t_10) {
 
-          /* "pysam/csamtools.pyx":775
+          /* "csamtools.pyx":775
  *                     self.index = bam_index_load(filename)
  *                     if self.index == NULL:
  *                         raise IOError("error while opening index `%s` " % filename )             # <<<<<<<<<<<<<<
  *             else:
  *                 self.index = bam_index_load(filename)
  */
-          __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), __pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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(((PyObject *)__pyx_t_5));
-          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7));
+          __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
+          __pyx_t_7 = 0;
+          __pyx_t_7 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_7);
-          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_5));
-          __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-          __pyx_t_5 = 0;
-          __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-          __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+          __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*/ {
 
-      /* "pysam/csamtools.pyx":777
+      /* "csamtools.pyx":777
  *                         raise IOError("error while opening index `%s` " % filename )
  *             else:
  *                 self.index = bam_index_load(filename)             # <<<<<<<<<<<<<<
@@ -8447,68 +7842,68 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
  *                     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);
 
-      /* "pysam/csamtools.pyx":778
+      /* "csamtools.pyx":778
  *             else:
  *                 self.index = bam_index_load(filename)
  *                 if self.index == NULL:             # <<<<<<<<<<<<<<
  *                     raise IOError("error while opening index `%s` " % filename )
  * 
  */
-      __pyx_t_11 = (__pyx_v_self->index == NULL);
-      if (__pyx_t_11) {
+      __pyx_t_10 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
+      if (__pyx_t_10) {
 
-        /* "pysam/csamtools.pyx":779
+        /* "csamtools.pyx":779
  *                 self.index = bam_index_load(filename)
  *                 if self.index == NULL:
  *                     raise IOError("error while opening index `%s` " % filename )             # <<<<<<<<<<<<<<
  * 
  *             if not self.isstream:
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), __pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __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(((PyObject *)__pyx_t_5));
-        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7));
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
+        __pyx_t_7 = 0;
+        __pyx_t_7 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_5));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-        __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+        __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:;
 
-    /* "pysam/csamtools.pyx":781
+    /* "csamtools.pyx":781
  *                     raise IOError("error while opening index `%s` " % filename )
  * 
  *             if not self.isstream:             # <<<<<<<<<<<<<<
  *                 self.start_offset = bam_tell( self.samfile.x.bam )
  * 
  */
-    __pyx_t_11 = (!__pyx_v_self->isstream);
-    if (__pyx_t_11) {
+    __pyx_t_10 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream);
+    if (__pyx_t_10) {
 
-      /* "pysam/csamtools.pyx":782
+      /* "csamtools.pyx":782
  * 
  *             if not self.isstream:
  *                 self.start_offset = bam_tell( self.samfile.x.bam )             # <<<<<<<<<<<<<<
  * 
  *     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;
@@ -8517,7 +7912,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_msg);
@@ -8536,19 +7931,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6_open(struct __pyx_obj_5py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_9gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/
-static char __pyx_doc_5pysam_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_5pysam_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_5pysam_9csamtools_7Samfile_8gettid(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self), ((PyObject *)__pyx_v_reference));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":784
+/* "csamtools.pyx":784
  *                 self.start_offset = bam_tell( self.samfile.x.bam )
  * 
  *     def gettid( self, reference ):             # <<<<<<<<<<<<<<
@@ -8556,7 +7939,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_9gettid(PyObject *__pyx_v_s
  *         convert :term:`reference` name into numerical :term:`tid`
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8gettid(struct __pyx_obj_5pysam_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;
@@ -8568,18 +7953,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8gettid(struct __pyx_obj_5p
   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);
 
-  /* "pysam/csamtools.pyx":790
+  /* "csamtools.pyx":790
  *         returns -1 if reference is not known.
  *         '''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *         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);
@@ -8593,24 +7978,24 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8gettid(struct __pyx_obj_5p
     __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:;
 
-  /* "pysam/csamtools.pyx":791
+  /* "csamtools.pyx":791
  *         '''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         reference = _force_bytes(reference)             # <<<<<<<<<<<<<<
  *         return pysam_reference2tid( self.samfile.header, reference )
  * 
  */
-  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_bytes(__pyx_v_reference)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_reference)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_v_reference);
   __pyx_v_reference = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":792
+  /* "csamtools.pyx":792
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         reference = _force_bytes(reference)
  *         return pysam_reference2tid( self.samfile.header, reference )             # <<<<<<<<<<<<<<
@@ -8619,7 +8004,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8gettid(struct __pyx_obj_5p
  */
   __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;
@@ -8630,7 +8015,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8gettid(struct __pyx_obj_5p
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.gettid", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.gettid", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_reference);
@@ -8640,19 +8025,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8gettid(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_11getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_10getrname[] = "Samfile.getrname(self, tid)\n\n        convert numerical :term:`tid` into :term:`reference` name.";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7Samfile_10getrname(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":794
+/* "csamtools.pyx":794
  *         return pysam_reference2tid( self.samfile.header, reference )
  * 
  *     def getrname( self, tid ):             # <<<<<<<<<<<<<<
@@ -8660,7 +8033,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_11getrname(PyObject *__pyx_
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj_5pysam_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;
@@ -8672,17 +8047,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj
   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);
 
-  /* "pysam/csamtools.pyx":797
+  /* "csamtools.pyx":797
  *         '''
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *         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);
@@ -8696,23 +8071,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":798
+  /* "csamtools.pyx":798
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         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 ) )
  *         return _charptr_to_str(self.samfile.header.target_name[tid])
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_v_tid, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_v_tid, Py_LE); 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);
   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); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   }
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8720,17 +8097,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":799
+    /* "csamtools.pyx":799
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         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 ) )             # <<<<<<<<<<<<<<
  *         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);
@@ -8741,7 +8118,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj
     __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;
@@ -8751,11 +8128,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(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 = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":800
+  /* "csamtools.pyx":800
  *         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 ) )
  *         return _charptr_to_str(self.samfile.header.target_name[tid])             # <<<<<<<<<<<<<<
@@ -8764,7 +8141,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj
  */
   __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_5pysam_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;
@@ -8775,7 +8152,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.getrname", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.getrname", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -8784,7 +8161,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":802
+/* "csamtools.pyx":802
  *         return _charptr_to_str(self.samfile.header.target_name[tid])
  * 
  *     cdef char * _getrname( self, int tid ): # TODO unused             # <<<<<<<<<<<<<<
@@ -8792,7 +8169,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10getrname(struct __pyx_obj
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  */
 
-static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, int __pyx_v_tid) {
+static char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, int __pyx_v_tid) {
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -8804,10 +8181,10 @@ static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysa
   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);
 
-  /* "pysam/csamtools.pyx":805
+  /* "csamtools.pyx":805
  *         '''
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -8832,7 +8209,7 @@ static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysa
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":806
+  /* "csamtools.pyx":806
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         if not 0 <= tid < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
@@ -8846,7 +8223,7 @@ static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysa
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":807
+    /* "csamtools.pyx":807
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         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 ) )             # <<<<<<<<<<<<<<
@@ -8858,7 +8235,7 @@ static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysa
     __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);
@@ -8869,7 +8246,7 @@ static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysa
     __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;
@@ -8883,7 +8260,7 @@ static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysa
   }
   __pyx_L4:;
 
-  /* "pysam/csamtools.pyx":808
+  /* "csamtools.pyx":808
  *         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 ) )
  *         return self.samfile.header.target_name[tid]             # <<<<<<<<<<<<<<
@@ -8899,7 +8276,7 @@ static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysa
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_WriteUnraisable("pysam.csamtools.Samfile._getrname", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_WriteUnraisable("csamtools.Samfile._getrname", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -8907,22 +8284,51 @@ static char *__pyx_f_5pysam_9csamtools_7Samfile__getrname(struct __pyx_obj_5pysa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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_5pysam_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;
-  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
     PyObject* values[4] = {0,0,0,0};
 
-    /* "pysam/csamtools.pyx":811
+    /* "csamtools.pyx":811
  * 
  *     def _parseRegion( self,
  *                       reference = None,             # <<<<<<<<<<<<<<
@@ -8931,7 +8337,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion(PyObject *__
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":812
+    /* "csamtools.pyx":812
  *     def _parseRegion( self,
  *                       reference = None,
  *                       start = None,             # <<<<<<<<<<<<<<
@@ -8940,7 +8346,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion(PyObject *__
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":813
+    /* "csamtools.pyx":813
  *                       reference = None,
  *                       start = None,
  *                       end = None,             # <<<<<<<<<<<<<<
@@ -8949,7 +8355,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion(PyObject *__
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":814
+    /* "csamtools.pyx":814
  *                       start = None,
  *                       end = None,
  *                       region = None ):             # <<<<<<<<<<<<<<
@@ -8959,8 +8365,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion(PyObject *__
     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);
@@ -8969,7 +8374,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion(PyObject *__
         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);
@@ -8992,7 +8397,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion(PyObject *__
         }
       }
       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)) {
@@ -9013,53 +8418,14 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion(PyObject *__
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":810
- *         return self.samfile.header.target_name[tid]
- * 
- *     def _parseRegion( self,             # <<<<<<<<<<<<<<
- *                       reference = None,
- *                       start = None,
- */
-
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":833
+  /* "csamtools.pyx":833
  *         cdef long long rend
  * 
  *         rtid = -1             # <<<<<<<<<<<<<<
@@ -9068,7 +8434,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
  */
   __pyx_v_rtid = -1;
 
-  /* "pysam/csamtools.pyx":834
+  /* "csamtools.pyx":834
  * 
  *         rtid = -1
  *         rstart = 0             # <<<<<<<<<<<<<<
@@ -9077,28 +8443,29 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
  */
   __pyx_v_rstart = 0;
 
-  /* "pysam/csamtools.pyx":835
+  /* "csamtools.pyx":835
  *         rtid = -1
  *         rstart = 0
  *         rend = max_pos             # <<<<<<<<<<<<<<
  *         if start != None:
  *             try:
  */
-  __pyx_v_rend = __pyx_v_5pysam_9csamtools_max_pos;
+  __pyx_v_rend = __pyx_v_9csamtools_max_pos;
 
-  /* "pysam/csamtools.pyx":836
+  /* "csamtools.pyx":836
  *         rstart = 0
  *         rend = max_pos
  *         if start != None:             # <<<<<<<<<<<<<<
  *             try:
  *                 rstart = start
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":837
+    /* "csamtools.pyx":837
  *         rend = max_pos
  *         if start != None:
  *             try:             # <<<<<<<<<<<<<<
@@ -9112,24 +8479,24 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
       __Pyx_XGOTREF(__pyx_t_5);
       /*try:*/ {
 
-        /* "pysam/csamtools.pyx":838
+        /* "csamtools.pyx":838
  *         if start != None:
  *             try:
  *                 rstart = start             # <<<<<<<<<<<<<<
  *             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;
 
-      /* "pysam/csamtools.pyx":839
+      /* "csamtools.pyx":839
  *             try:
  *                 rstart = start
  *             except OverflowError:             # <<<<<<<<<<<<<<
@@ -9138,67 +8505,68 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
  */
       __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
       if (__pyx_t_7) {
-        __Pyx_AddTraceback("pysam.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;}
+        __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_L9_except_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_GOTREF(__pyx_t_9);
 
-        /* "pysam/csamtools.pyx":840
+        /* "csamtools.pyx":840
  *                 rstart = start
  *             except OverflowError:
  *                 raise ValueError( 'start out of range (%i)' % start )             # <<<<<<<<<<<<<<
  * 
  *         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:;
 
-  /* "pysam/csamtools.pyx":842
+  /* "csamtools.pyx":842
  *                 raise ValueError( 'start out of range (%i)' % start )
  * 
  *         if end != None:             # <<<<<<<<<<<<<<
  *             try:
  *                 rend = end
  */
-  __pyx_t_9 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":843
+    /* "csamtools.pyx":843
  * 
  *         if end != None:
  *             try:             # <<<<<<<<<<<<<<
@@ -9212,28 +8580,28 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
       __Pyx_XGOTREF(__pyx_t_3);
       /*try:*/ {
 
-        /* "pysam/csamtools.pyx":844
+        /* "csamtools.pyx":844
  *         if end != None:
  *             try:
  *                 rend = end             # <<<<<<<<<<<<<<
  *             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;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-      /* "pysam/csamtools.pyx":845
+      /* "csamtools.pyx":845
  *             try:
  *                 rend = end
  *             except OverflowError:             # <<<<<<<<<<<<<<
@@ -9242,55 +8610,55 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
  */
       __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
       if (__pyx_t_7) {
-        __Pyx_AddTraceback("pysam.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;}
+        __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_L20_except_error;}
         __Pyx_GOTREF(__pyx_t_9);
         __Pyx_GOTREF(__pyx_t_8);
         __Pyx_GOTREF(__pyx_t_1);
 
-        /* "pysam/csamtools.pyx":846
+        /* "csamtools.pyx":846
  *                 rend = end
  *             except OverflowError:
  *                 raise ValueError( 'end out of range (%i)' % end )             # <<<<<<<<<<<<<<
  * 
  *         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:;
 
-  /* "pysam/csamtools.pyx":848
+  /* "csamtools.pyx":848
  *                 raise ValueError( 'end out of range (%i)' % end )
  * 
  *         if region:             # <<<<<<<<<<<<<<
@@ -9300,20 +8668,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":849
+    /* "csamtools.pyx":849
  * 
  *         if region:
  *             region = _force_str(region)             # <<<<<<<<<<<<<<
  *             parts = re.split( "[:-]", region )
  *             reference = parts[0]
  */
-    __pyx_t_1 = __pyx_f_5pysam_9csamtools__force_str(__pyx_v_region); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __pyx_f_9csamtools__force_str(__pyx_v_region); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_v_region);
     __pyx_v_region = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":850
+    /* "csamtools.pyx":850
  *         if region:
  *             region = _force_str(region)
  *             parts = re.split( "[:-]", region )             # <<<<<<<<<<<<<<
@@ -9326,7 +8694,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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));
@@ -9340,7 +8708,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __pyx_v_parts = __pyx_t_9;
     __pyx_t_9 = 0;
 
-    /* "pysam/csamtools.pyx":851
+    /* "csamtools.pyx":851
  *             region = _force_str(region)
  *             parts = re.split( "[:-]", region )
  *             reference = parts[0]             # <<<<<<<<<<<<<<
@@ -9353,7 +8721,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __pyx_v_reference = __pyx_t_9;
     __pyx_t_9 = 0;
 
-    /* "pysam/csamtools.pyx":852
+    /* "csamtools.pyx":852
  *             parts = re.split( "[:-]", region )
  *             reference = parts[0]
  *             if len(parts) >= 2: rstart = int(parts[1]) - 1             # <<<<<<<<<<<<<<
@@ -9366,7 +8734,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
       __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;
@@ -9379,11 +8747,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
       __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:;
 
-    /* "pysam/csamtools.pyx":853
+    /* "csamtools.pyx":853
  *             reference = parts[0]
  *             if len(parts) >= 2: rstart = int(parts[1]) - 1
  *             if len(parts) >= 3: rend = int(parts[2])             # <<<<<<<<<<<<<<
@@ -9396,7 +8764,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
       __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;
@@ -9406,14 +8774,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
       __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:;
 
-  /* "pysam/csamtools.pyx":855
+  /* "csamtools.pyx":855
  *             if len(parts) >= 3: rend = int(parts[2])
  * 
  *         if not reference: return 0, 0, 0, 0             # <<<<<<<<<<<<<<
@@ -9427,21 +8795,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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:;
 
-  /* "pysam/csamtools.pyx":857
+  /* "csamtools.pyx":857
  *         if not reference: return 0, 0, 0, 0
  * 
  *         rtid = self.gettid( reference )             # <<<<<<<<<<<<<<
  *         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);
@@ -9453,7 +8821,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   __pyx_v_rtid = __pyx_t_7;
 
-  /* "pysam/csamtools.pyx":858
+  /* "csamtools.pyx":858
  * 
  *         rtid = self.gettid( reference )
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )             # <<<<<<<<<<<<<<
@@ -9465,7 +8833,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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;
@@ -9475,11 +8843,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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:;
 
-  /* "pysam/csamtools.pyx":859
+  /* "csamtools.pyx":859
  *         rtid = self.gettid( reference )
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )             # <<<<<<<<<<<<<<
@@ -9493,7 +8861,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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);
@@ -9504,7 +8872,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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;
@@ -9514,11 +8882,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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:;
 
-  /* "pysam/csamtools.pyx":860
+  /* "csamtools.pyx":860
  *         if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
  *         if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )             # <<<<<<<<<<<<<<
@@ -9527,7 +8895,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
  */
   __pyx_t_13 = (0 <= __pyx_v_rstart);
   if (__pyx_t_13) {
-    __pyx_t_13 = (__pyx_v_rstart < __pyx_v_5pysam_9csamtools_max_pos);
+    __pyx_t_13 = (__pyx_v_rstart < __pyx_v_9csamtools_max_pos);
   }
   __pyx_t_2 = (!__pyx_t_13);
   if (__pyx_t_2) {
@@ -9537,7 +8905,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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;
@@ -9547,11 +8915,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(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 = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L31;
+    goto __pyx_L34;
   }
-  __pyx_L31:;
+  __pyx_L34:;
 
-  /* "pysam/csamtools.pyx":861
+  /* "csamtools.pyx":861
  *         if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
  *         if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
  *         if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )             # <<<<<<<<<<<<<<
@@ -9560,7 +8928,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
  */
   __pyx_t_2 = (0 <= __pyx_v_rend);
   if (__pyx_t_2) {
-    __pyx_t_2 = (__pyx_v_rend <= __pyx_v_5pysam_9csamtools_max_pos);
+    __pyx_t_2 = (__pyx_v_rend <= __pyx_v_9csamtools_max_pos);
   }
   __pyx_t_13 = (!__pyx_t_2);
   if (__pyx_t_13) {
@@ -9570,7 +8938,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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;
@@ -9580,11 +8948,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
     __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:;
 
-  /* "pysam/csamtools.pyx":863
+  /* "csamtools.pyx":863
  *         if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
  * 
  *         return 1, rtid, rstart, rend             # <<<<<<<<<<<<<<
@@ -9599,7 +8967,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
   __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);
@@ -9624,7 +8992,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_parts);
@@ -9636,19 +9004,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_12_parseRegion(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_15reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_14reset[] = "Samfile.reset(self)\nreset file position to beginning of read section.";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7Samfile_14reset(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":865
+/* "csamtools.pyx":865
  *         return 1, rtid, rstart, rend
  * 
  *     def reset( self ):             # <<<<<<<<<<<<<<
@@ -9656,7 +9012,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_15reset(PyObject *__pyx_v_s
  *         return self.seek( self.start_offset, 0 )
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_14reset(struct __pyx_obj_5pysam_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;
@@ -9666,10 +9024,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_14reset(struct __pyx_obj_5p
   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);
 
-  /* "pysam/csamtools.pyx":867
+  /* "csamtools.pyx":867
  *     def reset( self ):
  *         '''reset file position to beginning of read section.'''
  *         return self.seek( self.start_offset, 0 )             # <<<<<<<<<<<<<<
@@ -9677,12 +9035,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_14reset(struct __pyx_obj_5p
  *     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);
@@ -9703,7 +9061,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_14reset(struct __pyx_obj_5p
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -9712,31 +9070,47 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_14reset(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_17seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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_5pysam_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;
-  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__where,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -9745,7 +9119,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_17seek(PyObject *__pyx_v_se
         }
       }
       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 (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)) {
@@ -9766,45 +9140,19 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_17seek(PyObject *__pyx_v_se
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_16seek(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self), __pyx_v_offset, __pyx_v_where);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/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_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5pysam_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);
-
-  /* "pysam/csamtools.pyx":874
+  /* "csamtools.pyx":874
  *         '''
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             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);
@@ -9814,7 +9162,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5py
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":875
+    /* "csamtools.pyx":875
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -9826,21 +9174,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5py
     __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:;
 
-  /* "pysam/csamtools.pyx":876
+  /* "csamtools.pyx":876
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":877
+    /* "csamtools.pyx":877
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")             # <<<<<<<<<<<<<<
@@ -9852,20 +9200,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5py
     __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:;
 
-  /* "pysam/csamtools.pyx":878
+  /* "csamtools.pyx":878
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")
  *         if self.isstream:             # <<<<<<<<<<<<<<
  *             raise OSError("seek no available in streams")
  * 
  */
-  if (__pyx_v_self->isstream) {
+  if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) {
 
-    /* "pysam/csamtools.pyx":879
+    /* "csamtools.pyx":879
  *             raise NotImplementedError("seek only available in bam files")
  *         if self.isstream:
  *             raise OSError("seek no available in streams")             # <<<<<<<<<<<<<<
@@ -9877,11 +9225,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5py
     __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:;
 
-  /* "pysam/csamtools.pyx":881
+  /* "csamtools.pyx":881
  *             raise OSError("seek no available in streams")
  * 
  *         return bam_seek( self.samfile.x.bam, offset, where )             # <<<<<<<<<<<<<<
@@ -9889,7 +9237,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5py
  *     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;
@@ -9900,7 +9248,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5py
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -9909,19 +9257,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_16seek(struct __pyx_obj_5py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_19tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_18tell[] = "Samfile.tell(self)\n\n        return current file position\n        ";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7Samfile_18tell(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":883
+/* "csamtools.pyx":883
  *         return bam_seek( self.samfile.x.bam, offset, where )
  * 
  *     def tell( self ):             # <<<<<<<<<<<<<<
@@ -9929,7 +9265,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_19tell(PyObject *__pyx_v_se
  *         return current file position
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5pysam_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;
@@ -9940,17 +9278,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5py
   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);
 
-  /* "pysam/csamtools.pyx":887
+  /* "csamtools.pyx":887
  *         return current file position
  *         '''
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             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);
@@ -9960,7 +9298,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5py
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":888
+    /* "csamtools.pyx":888
  *         '''
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -9972,21 +9310,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5py
     __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:;
 
-  /* "pysam/csamtools.pyx":889
+  /* "csamtools.pyx":889
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":890
+    /* "csamtools.pyx":890
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")             # <<<<<<<<<<<<<<
@@ -9998,11 +9336,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5py
     __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:;
 
-  /* "pysam/csamtools.pyx":892
+  /* "csamtools.pyx":892
  *             raise NotImplementedError("seek only available in bam files")
  * 
  *         return bam_tell( self.samfile.x.bam )             # <<<<<<<<<<<<<<
@@ -10010,7 +9348,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5py
  *     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;
@@ -10021,7 +9359,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5py
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -10030,24 +9368,56 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_18tell(struct __pyx_obj_5py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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\ [...]
-static PyObject *__pyx_pw_5pysam_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;
-  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);
   {
-    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* values[6] = {0,0,0,0,0,0};
 
-    /* "pysam/csamtools.pyx":895
+    /* "csamtools.pyx":895
  * 
  *     def fetch( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -10056,7 +9426,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_s
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":896
+    /* "csamtools.pyx":896
  *     def fetch( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -10065,7 +9435,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_s
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":897
+    /* "csamtools.pyx":897
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -10074,7 +9444,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_s
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":898
+    /* "csamtools.pyx":898
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -10083,7 +9453,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_s
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":899
+    /* "csamtools.pyx":899
  *                end = None,
  *                region = None,
  *                callback = None,             # <<<<<<<<<<<<<<
@@ -10094,8 +9464,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_s
     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);
@@ -10106,7 +9475,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(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);
@@ -10139,7 +9508,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_s
         }
       }
       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)) {
@@ -10164,61 +9533,19 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_s
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_20fetch(((struct __pyx_obj_5pysam_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;
-}
-
-/* "pysam/csamtools.pyx":894
- *         return bam_tell( self.samfile.x.bam )
- * 
- *     def fetch( self,             # <<<<<<<<<<<<<<
- *                reference = None,
- *                start = None,
- */
-
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":924
+  /* "csamtools.pyx":924
  *         cdef int rtid, rstart, rend, has_coord
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             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);
@@ -10228,7 +9555,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":925
+    /* "csamtools.pyx":925
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -10240,21 +9567,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
     __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:;
 
-  /* "pysam/csamtools.pyx":927
+  /* "csamtools.pyx":927
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )             # <<<<<<<<<<<<<<
  * 
  *         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);
@@ -10273,23 +9600,22 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
     PyObject* sequence = __pyx_t_5;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    Py_ssize_t size = Py_SIZE(sequence);
-    #else
-    Py_ssize_t size = PySequence_Size(sequence);
-    #endif
-    if (unlikely(size != 4)) {
-      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
-      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
+      if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
+        if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
+        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
       __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
     } else {
+      if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
+        if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
+        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
@@ -10299,38 +9625,30 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
     __Pyx_INCREF(__pyx_t_2);
     __Pyx_INCREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_t_7);
-    #else
-    Py_ssize_t i;
-    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
-    for (i=0; i < 4; i++) {
-      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      *(temps[i]) = item;
-    }
-    #endif
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  } else
-  {
+  } else {
     Py_ssize_t index = -1;
-    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
     __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-    for (index=0; index < 4; index++) {
-      PyObject* item = __pyx_t_9(__pyx_t_8); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
-      __Pyx_GOTREF(item);
-      *(temps[index]) = item;
-    }
+    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_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_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_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_t_9 = NULL;
     __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;
-    __pyx_t_9 = NULL;
-    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+    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;
@@ -10345,20 +9663,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
   __pyx_v_rstart = __pyx_t_12;
   __pyx_v_rend = __pyx_t_13;
 
-  /* "pysam/csamtools.pyx":929
+  /* "csamtools.pyx":929
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  * 
  *         if self.isstream: reopen = False             # <<<<<<<<<<<<<<
  *         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*/ {
 
-    /* "pysam/csamtools.pyx":930
+    /* "csamtools.pyx":930
  * 
  *         if self.isstream: reopen = False
  *         else: reopen = True             # <<<<<<<<<<<<<<
@@ -10367,18 +9685,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
  */
     __pyx_v_reopen = 1;
   }
-  __pyx_L6:;
+  __pyx_L9:;
 
-  /* "pysam/csamtools.pyx":932
+  /* "csamtools.pyx":932
  *         else: reopen = True
  * 
  *         if self.isbam:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":933
+    /* "csamtools.pyx":933
  * 
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:             # <<<<<<<<<<<<<<
@@ -10388,7 +9706,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
     __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);
@@ -10397,7 +9715,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
       __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;
@@ -10408,7 +9726,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
     }
     if (__pyx_t_14) {
 
-      /* "pysam/csamtools.pyx":934
+      /* "csamtools.pyx":934
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )             # <<<<<<<<<<<<<<
@@ -10420,11 +9738,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
       __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:;
 
-    /* "pysam/csamtools.pyx":936
+    /* "csamtools.pyx":936
  *                 raise ValueError( "fetch called on bamfile without index" )
  * 
  *             if callback:             # <<<<<<<<<<<<<<
@@ -10434,7 +9752,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
     __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_14) {
 
-      /* "pysam/csamtools.pyx":937
+      /* "csamtools.pyx":937
  * 
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )             # <<<<<<<<<<<<<<
@@ -10448,18 +9766,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
         __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:;
 
-      /* "pysam/csamtools.pyx":938
+      /* "csamtools.pyx":938
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  *                 if not self._hasIndex(): raise ValueError( "no index available for fetch" )             # <<<<<<<<<<<<<<
  *                 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);
@@ -10473,11 +9791,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
         __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:;
 
-      /* "pysam/csamtools.pyx":939
+      /* "csamtools.pyx":939
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  *                 if not self._hasIndex(): raise ValueError( "no index available for fetch" )
  *                 return bam_fetch(self.samfile.x.bam,             # <<<<<<<<<<<<<<
@@ -10486,23 +9804,23 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
  */
       __Pyx_XDECREF(__pyx_r);
 
-      /* "pysam/csamtools.pyx":945
+      /* "csamtools.pyx":945
  *                                  rend,
  *                                  <void*>callback,
  *                                  fetch_callback )             # <<<<<<<<<<<<<<
  *             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_5pysam_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*/ {
 
-      /* "pysam/csamtools.pyx":947
+      /* "csamtools.pyx":947
  *                                  fetch_callback )
  *             else:
  *                 if has_coord:             # <<<<<<<<<<<<<<
@@ -10511,7 +9829,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
  */
       if (__pyx_v_has_coord) {
 
-        /* "pysam/csamtools.pyx":948
+        /* "csamtools.pyx":948
  *             else:
  *                 if has_coord:
  *                     return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )             # <<<<<<<<<<<<<<
@@ -10526,10 +9844,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
         __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);
@@ -10545,18 +9863,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
         __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_5pysam_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*/ {
 
-        /* "pysam/csamtools.pyx":950
+        /* "csamtools.pyx":950
  *                     return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )
  *                 else:
  *                     if until_eof:             # <<<<<<<<<<<<<<
@@ -10566,7 +9884,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
         __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         if (__pyx_t_3) {
 
-          /* "pysam/csamtools.pyx":951
+          /* "csamtools.pyx":951
  *                 else:
  *                     if until_eof:
  *                         return IteratorRowAll( self, reopen=reopen )             # <<<<<<<<<<<<<<
@@ -10575,28 +9893,28 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
  */
           __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_5pysam_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*/ {
 
-          /* "pysam/csamtools.pyx":954
+          /* "csamtools.pyx":954
  *                     else:
  *                         # AH: check - reason why no reopen for AllRefs?
  *                         return IteratorRowAllRefs(self ) # , reopen=reopen )             # <<<<<<<<<<<<<<
@@ -10605,27 +9923,27 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
  */
           __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_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_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(((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;
           __pyx_r = __pyx_t_6;
           __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*/ {
 
-    /* "pysam/csamtools.pyx":956
+    /* "csamtools.pyx":956
  *                         return IteratorRowAllRefs(self ) # , reopen=reopen )
  *         else:
  *             if has_coord:             # <<<<<<<<<<<<<<
@@ -10634,7 +9952,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
  */
     if (__pyx_v_has_coord) {
 
-      /* "pysam/csamtools.pyx":957
+      /* "csamtools.pyx":957
  *         else:
  *             if has_coord:
  *                 raise ValueError ("fetching by region is not available for sam files" )             # <<<<<<<<<<<<<<
@@ -10646,11 +9964,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
       __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:;
 
-    /* "pysam/csamtools.pyx":959
+    /* "csamtools.pyx":959
  *                 raise ValueError ("fetching by region is not available for sam files" )
  * 
  *             if callback:             # <<<<<<<<<<<<<<
@@ -10660,7 +9978,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_3) {
 
-      /* "pysam/csamtools.pyx":960
+      /* "csamtools.pyx":960
  * 
  *             if callback:
  *                 raise NotImplementedError( "callback not implemented yet" )             # <<<<<<<<<<<<<<
@@ -10672,21 +9990,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
       __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:;
 
-    /* "pysam/csamtools.pyx":962
+    /* "csamtools.pyx":962
  *                 raise NotImplementedError( "callback not implemented yet" )
  * 
  *             if self.samfile.header == NULL:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":963
+      /* "csamtools.pyx":963
  * 
  *             if self.samfile.header == NULL:
  *                 raise ValueError( "fetch called for samfile without header")             # <<<<<<<<<<<<<<
@@ -10698,21 +10016,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
       __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:;
 
-    /* "pysam/csamtools.pyx":967
+    /* "csamtools.pyx":967
  *             # check if targets are defined
  *             # give warning, sam_read1 segfaults
  *             if self.samfile.header.n_targets == 0:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":968
+      /* "csamtools.pyx":968
  *             # give warning, sam_read1 segfaults
  *             if self.samfile.header.n_targets == 0:
  *                 warnings.warn( "fetch called for samfile without header")             # <<<<<<<<<<<<<<
@@ -10728,11 +10046,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
       __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:;
 
-    /* "pysam/csamtools.pyx":970
+    /* "csamtools.pyx":970
  *                 warnings.warn( "fetch called for samfile without header")
  * 
  *             return IteratorRowAll( self, reopen=reopen )             # <<<<<<<<<<<<<<
@@ -10741,17 +10059,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
  */
     __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_5pysam_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;
@@ -10759,7 +10077,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
     __pyx_t_7 = 0;
     goto __pyx_L0;
   }
-  __pyx_L7:;
+  __pyx_L10:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -10770,7 +10088,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -10779,24 +10097,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_20fetch(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_23mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
-static char __pyx_doc_5pysam_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_5pysam_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_5pysam_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_22mate(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_read));
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":972
+/* "csamtools.pyx":972
  *             return IteratorRowAll( self, reopen=reopen )
  * 
  *     def mate( self,             # <<<<<<<<<<<<<<
@@ -10804,119 +10105,119 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_23mate(PyObject *__pyx_v_se
  *         '''return the mate of :class:`AlignedRead` *read*.
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_22mate(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_5pysam_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_5pysam_9csamtools_MateData __pyx_v_mate_data;
+  __pyx_t_9csamtools_MateData __pyx_v_mate_data;
   int __pyx_v_x;
-  struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_dest = 0;
+  struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_dest = 0;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  uint32_t __pyx_t_1;
-  int __pyx_t_2;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  bam1_t *__pyx_t_5;
   int __pyx_lineno = 0;
   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;}
 
-  /* "pysam/csamtools.pyx":985
+  /* "csamtools.pyx":985
  * 
  *         '''
  *         cdef uint32_t flag = read._delegate.core.flag             # <<<<<<<<<<<<<<
  * 
  *         if flag & BAM_FPAIRED == 0:
  */
-  __pyx_t_1 = __pyx_v_read->_delegate->core.flag;
-  __pyx_v_flag = __pyx_t_1;
+  __pyx_v_flag = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.flag;
 
-  /* "pysam/csamtools.pyx":987
+  /* "csamtools.pyx":987
  *         cdef uint32_t flag = read._delegate.core.flag
  * 
  *         if flag & BAM_FPAIRED == 0:             # <<<<<<<<<<<<<<
  *             raise ValueError( "read %s: is unpaired" % (read.qname))
  *         if flag & BAM_FMUNMAP != 0:
  */
-  __pyx_t_2 = ((__pyx_v_flag & 1) == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = ((__pyx_v_flag & 1) == 0);
+  if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":988
+    /* "csamtools.pyx":988
  * 
  *         if flag & BAM_FPAIRED == 0:
  *             raise ValueError( "read %s: is unpaired" % (read.qname))             # <<<<<<<<<<<<<<
  *         if flag & BAM_FMUNMAP != 0:
  *             raise ValueError( "mate %s: is unmapped" % (read.qname))
  */
-    __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 = 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(((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;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_69), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __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 = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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:;
 
-  /* "pysam/csamtools.pyx":989
+  /* "csamtools.pyx":989
  *         if flag & BAM_FPAIRED == 0:
  *             raise ValueError( "read %s: is unpaired" % (read.qname))
  *         if flag & BAM_FMUNMAP != 0:             # <<<<<<<<<<<<<<
  *             raise ValueError( "mate %s: is unmapped" % (read.qname))
  * 
  */
-  __pyx_t_2 = ((__pyx_v_flag & 8) != 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = ((__pyx_v_flag & 8) != 0);
+  if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":990
+    /* "csamtools.pyx":990
  *             raise ValueError( "read %s: is unpaired" % (read.qname))
  *         if flag & BAM_FMUNMAP != 0:
  *             raise ValueError( "mate %s: is unmapped" % (read.qname))             # <<<<<<<<<<<<<<
  * 
  *         cdef MateData mate_data
  */
-    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_read), __pyx_n_s__qname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __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(((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;
+    __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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":994
+  /* "csamtools.pyx":994
  *         cdef MateData mate_data
  * 
  *         mate_data.name = <char *>bam1_qname(read._delegate)             # <<<<<<<<<<<<<<
  *         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));
 
-  /* "pysam/csamtools.pyx":995
+  /* "csamtools.pyx":995
  * 
  *         mate_data.name = <char *>bam1_qname(read._delegate)
  *         mate_data.mate = NULL             # <<<<<<<<<<<<<<
@@ -10925,7 +10226,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_22mate(struct __pyx_obj_5py
  */
   __pyx_v_mate_data.mate = NULL;
 
-  /* "pysam/csamtools.pyx":997
+  /* "csamtools.pyx":997
  *         mate_data.mate = NULL
  *         # xor flags to get the other mate
  *         cdef int x = BAM_FREAD1 + BAM_FREAD2             # <<<<<<<<<<<<<<
@@ -10934,7 +10235,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_22mate(struct __pyx_obj_5py
  */
   __pyx_v_x = 192;
 
-  /* "pysam/csamtools.pyx":998
+  /* "csamtools.pyx":998
  *         # xor flags to get the other mate
  *         cdef int x = BAM_FREAD1 + BAM_FREAD2
  *         mate_data.flag = ( flag ^ x) & x             # <<<<<<<<<<<<<<
@@ -10943,65 +10244,64 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_22mate(struct __pyx_obj_5py
  */
   __pyx_v_mate_data.flag = ((__pyx_v_flag ^ __pyx_v_x) & __pyx_v_x);
 
-  /* "pysam/csamtools.pyx":1006
+  /* "csamtools.pyx":1006
  *                   read._delegate.core.mpos + 1,
  *                   <void*>&mate_data,
  *                   mate_callback )             # <<<<<<<<<<<<<<
  * 
  *         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_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1008
+  /* "csamtools.pyx":1008
  *                   mate_callback )
  * 
  *         if mate_data.mate == NULL:             # <<<<<<<<<<<<<<
  *             raise ValueError( "mate not found" )
  * 
  */
-  __pyx_t_2 = (__pyx_v_mate_data.mate == NULL);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_mate_data.mate == NULL);
+  if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":1009
+    /* "csamtools.pyx":1009
  * 
  *         if mate_data.mate == NULL:
  *             raise ValueError( "mate not found" )             # <<<<<<<<<<<<<<
  * 
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __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_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __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 = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L5;
+    goto __pyx_L7;
   }
-  __pyx_L5:;
+  __pyx_L7:;
 
-  /* "pysam/csamtools.pyx":1011
+  /* "csamtools.pyx":1011
  *             raise ValueError( "mate not found" )
  * 
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)             # <<<<<<<<<<<<<<
  *         dest._delegate = mate_data.mate
  *         return dest
  */
-  __pyx_t_3 = __Pyx_tp_new(((PyObject*)__pyx_ptype_5pysam_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5pysam_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_dest = ((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_t_3);
-  __pyx_t_3 = 0;
+  __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_2);
+  __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":1012
+  /* "csamtools.pyx":1012
  * 
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  *         dest._delegate = mate_data.mate             # <<<<<<<<<<<<<<
  *         return dest
  * 
  */
-  __pyx_t_5 = __pyx_v_mate_data.mate;
-  __pyx_v_dest->_delegate = __pyx_t_5;
+  __pyx_v_dest->_delegate = __pyx_v_mate_data.mate;
 
-  /* "pysam/csamtools.pyx":1013
+  /* "csamtools.pyx":1013
  *         cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
  *         dest._delegate = mate_data.mate
  *         return dest             # <<<<<<<<<<<<<<
@@ -11016,9 +10316,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_22mate(struct __pyx_obj_5py
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.mate", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.mate", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF((PyObject *)__pyx_v_dest);
@@ -11028,23 +10328,53 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_22mate(struct __pyx_obj_5py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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 d [...]
-static PyObject *__pyx_pw_5pysam_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;
-  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);
   {
-    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* values[5] = {0,0,0,0,0};
 
-    /* "pysam/csamtools.pyx":1016
+    /* "csamtools.pyx":1016
  * 
  *     def count( self,
  *                reference = None,             # <<<<<<<<<<<<<<
@@ -11053,7 +10383,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_25count(PyObject *__pyx_v_s
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":1017
+    /* "csamtools.pyx":1017
  *     def count( self,
  *                reference = None,
  *                start = None,             # <<<<<<<<<<<<<<
@@ -11062,7 +10392,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_25count(PyObject *__pyx_v_s
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":1018
+    /* "csamtools.pyx":1018
  *                reference = None,
  *                start = None,
  *                end = None,             # <<<<<<<<<<<<<<
@@ -11071,7 +10401,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_25count(PyObject *__pyx_v_s
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":1019
+    /* "csamtools.pyx":1019
  *                start = None,
  *                end = None,
  *                region = None,             # <<<<<<<<<<<<<<
@@ -11082,8 +10412,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_25count(PyObject *__pyx_v_s
     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);
@@ -11093,7 +10422,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_25count(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);
@@ -11121,7 +10450,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_25count(PyObject *__pyx_v_s
         }
       }
       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)) {
@@ -11144,60 +10473,20 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_25count(PyObject *__pyx_v_s
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("count", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.count", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.count", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_24count(((struct __pyx_obj_5pysam_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;
-}
-
-/* "pysam/csamtools.pyx":1015
- *         return dest
- * 
- *     def count( self,             # <<<<<<<<<<<<<<
- *                reference = None,
- *                start = None,
- */
-
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1033
+  /* "csamtools.pyx":1033
  *         cdef int rend
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             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);
@@ -11207,7 +10496,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":1034
+    /* "csamtools.pyx":1034
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -11219,21 +10508,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
     __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:;
 
-  /* "pysam/csamtools.pyx":1036
+  /* "csamtools.pyx":1036
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )             # <<<<<<<<<<<<<<
  * 
  *         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);
@@ -11252,23 +10541,22 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
     PyObject* sequence = __pyx_t_5;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    Py_ssize_t size = Py_SIZE(sequence);
-    #else
-    Py_ssize_t size = PySequence_Size(sequence);
-    #endif
-    if (unlikely(size != 4)) {
-      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
-      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
+      if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
+        if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
+        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
       __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
     } else {
+      if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
+        if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
+        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
@@ -11278,38 +10566,30 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
     __Pyx_INCREF(__pyx_t_2);
     __Pyx_INCREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_t_7);
-    #else
-    Py_ssize_t i;
-    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
-    for (i=0; i < 4; i++) {
-      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      *(temps[i]) = item;
-    }
-    #endif
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  } else
-  {
+  } else {
     Py_ssize_t index = -1;
-    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
     __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-    for (index=0; index < 4; index++) {
-      PyObject* item = __pyx_t_9(__pyx_t_8); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
-      __Pyx_GOTREF(item);
-      *(temps[index]) = item;
-    }
+    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_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_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_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_t_9 = NULL;
     __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;
-    __pyx_t_9 = NULL;
-    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+    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;
@@ -11324,7 +10604,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
   __pyx_v_rstart = __pyx_t_11;
   __pyx_v_rend = __pyx_t_12;
 
-  /* "pysam/csamtools.pyx":1039
+  /* "csamtools.pyx":1039
  * 
  *         cdef int counter
  *         counter = 0;             # <<<<<<<<<<<<<<
@@ -11333,16 +10613,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
  */
   __pyx_v_counter = 0;
 
-  /* "pysam/csamtools.pyx":1041
+  /* "csamtools.pyx":1041
  *         counter = 0;
  * 
  *         if self.isbam:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":1042
+    /* "csamtools.pyx":1042
  * 
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:             # <<<<<<<<<<<<<<
@@ -11352,7 +10632,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
     __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);
@@ -11361,7 +10641,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
       __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;
@@ -11372,7 +10652,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
     }
     if (__pyx_t_13) {
 
-      /* "pysam/csamtools.pyx":1043
+      /* "csamtools.pyx":1043
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )             # <<<<<<<<<<<<<<
@@ -11384,11 +10664,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
       __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:;
 
-    /* "pysam/csamtools.pyx":1045
+    /* "csamtools.pyx":1045
  *                 raise ValueError( "fetch called on bamfile without index" )
  * 
  *             if not region:             # <<<<<<<<<<<<<<
@@ -11399,7 +10679,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
     __pyx_t_3 = (!__pyx_t_13);
     if (__pyx_t_3) {
 
-      /* "pysam/csamtools.pyx":1046
+      /* "csamtools.pyx":1046
  * 
  *             if not region:
  *                 raise ValueError( "counting functionality requires a region/reference" )             # <<<<<<<<<<<<<<
@@ -11411,18 +10691,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
       __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:;
 
-    /* "pysam/csamtools.pyx":1047
+    /* "csamtools.pyx":1047
  *             if not region:
  *                 raise ValueError( "counting functionality requires a region/reference" )
  *             if not self._hasIndex(): raise ValueError( "no index available for fetch" )             # <<<<<<<<<<<<<<
  *             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);
@@ -11436,20 +10716,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
       __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:;
 
-    /* "pysam/csamtools.pyx":1054
+    /* "csamtools.pyx":1054
  *                              rend,
  *                              <void*>&counter,
  *                              count_callback )             # <<<<<<<<<<<<<<
  *             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_5pysam_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);
 
-    /* "pysam/csamtools.pyx":1055
+    /* "csamtools.pyx":1055
  *                              <void*>&counter,
  *                              count_callback )
  *             return counter             # <<<<<<<<<<<<<<
@@ -11462,11 +10742,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
     __pyx_r = __pyx_t_5;
     __pyx_t_5 = 0;
     goto __pyx_L0;
-    goto __pyx_L6;
+    goto __pyx_L9;
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":1057
+    /* "csamtools.pyx":1057
  *             return counter
  *         else:
  *             raise ValueError ("count for a region is not available for sam files" )             # <<<<<<<<<<<<<<
@@ -11479,7 +10759,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
     __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;
@@ -11490,7 +10770,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.count", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.count", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_region);
@@ -11500,26 +10780,56 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_24count(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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 retu [...]
-static PyObject *__pyx_pw_5pysam_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;
-  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);
   {
-    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* values[5] = {0,0,0,0,0};
 
-    /* "pysam/csamtools.pyx":1060
+    /* "csamtools.pyx":1060
  * 
  *     def pileup( self,
  *                 reference = None,             # <<<<<<<<<<<<<<
@@ -11528,7 +10838,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_
  */
     values[0] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":1061
+    /* "csamtools.pyx":1061
  *     def pileup( self,
  *                 reference = None,
  *                 start = None,             # <<<<<<<<<<<<<<
@@ -11537,7 +10847,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_
  */
     values[1] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":1062
+    /* "csamtools.pyx":1062
  *                 reference = None,
  *                 start = None,
  *                 end = None,             # <<<<<<<<<<<<<<
@@ -11546,7 +10856,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_
  */
     values[2] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":1063
+    /* "csamtools.pyx":1063
  *                 start = None,
  *                 end = None,
  *                 region = None,             # <<<<<<<<<<<<<<
@@ -11555,7 +10865,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "pysam/csamtools.pyx":1064
+    /* "csamtools.pyx":1064
  *                 end = None,
  *                 region = None,
  *                 callback = None,             # <<<<<<<<<<<<<<
@@ -11565,8 +10875,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_
     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);
@@ -11576,7 +10885,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(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:
         if (kw_args > 0) {
           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
@@ -11604,7 +10913,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_
         }
       }
       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)) {
@@ -11628,60 +10937,19 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_
   __Pyx_RaiseArgtupleInvalid("pileup", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_26pileup(((struct __pyx_obj_5pysam_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;
-}
-
-/* "pysam/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_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5pysam_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);
-
-  /* "pysam/csamtools.pyx":1115
+  /* "csamtools.pyx":1115
  *         cdef bam_plbuf_t *buf
  * 
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
  *             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);
@@ -11691,7 +10959,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":1116
+    /* "csamtools.pyx":1116
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -11703,21 +10971,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
     __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:;
 
-  /* "pysam/csamtools.pyx":1118
+  /* "csamtools.pyx":1118
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )             # <<<<<<<<<<<<<<
  * 
  *         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);
@@ -11736,23 +11004,22 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
     PyObject* sequence = __pyx_t_5;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    Py_ssize_t size = Py_SIZE(sequence);
-    #else
-    Py_ssize_t size = PySequence_Size(sequence);
-    #endif
-    if (unlikely(size != 4)) {
-      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
-      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
+      if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
+        if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
+        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
       __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
     } else {
+      if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
+        if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
+        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
@@ -11762,38 +11029,30 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
     __Pyx_INCREF(__pyx_t_2);
     __Pyx_INCREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_t_7);
-    #else
-    Py_ssize_t i;
-    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
-    for (i=0; i < 4; i++) {
-      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      *(temps[i]) = item;
-    }
-    #endif
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  } else
-  {
+  } else {
     Py_ssize_t index = -1;
-    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
     __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-    for (index=0; index < 4; index++) {
-      PyObject* item = __pyx_t_9(__pyx_t_8); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
-      __Pyx_GOTREF(item);
-      *(temps[index]) = item;
-    }
+    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_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_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_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_t_9 = NULL;
     __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;
-    __pyx_t_9 = NULL;
-    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+    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;
@@ -11808,23 +11067,23 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
   __pyx_v_rstart = __pyx_t_12;
   __pyx_v_rend = __pyx_t_13;
 
-  /* "pysam/csamtools.pyx":1120
+  /* "csamtools.pyx":1120
  *         has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
  * 
  *         if self.isbam:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":1121
+    /* "csamtools.pyx":1121
  * 
  *         if self.isbam:
  *             if not self._hasIndex(): raise ValueError( "no index available for pileup" )             # <<<<<<<<<<<<<<
  * 
  *             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);
@@ -11838,11 +11097,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
       __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:;
 
-    /* "pysam/csamtools.pyx":1123
+    /* "csamtools.pyx":1123
  *             if not self._hasIndex(): raise ValueError( "no index available for pileup" )
  * 
  *             if callback:             # <<<<<<<<<<<<<<
@@ -11852,7 +11111,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_3) {
 
-      /* "pysam/csamtools.pyx":1124
+      /* "csamtools.pyx":1124
  * 
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )             # <<<<<<<<<<<<<<
@@ -11866,29 +11125,29 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
         __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:;
 
-      /* "pysam/csamtools.pyx":1126
+      /* "csamtools.pyx":1126
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  * 
  *                 buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback )             # <<<<<<<<<<<<<<
  *                 bam_fetch(self.samfile.x.bam,
  *                           self.index, rtid, rstart, rend,
  */
-      __pyx_v_buf = bam_plbuf_init(((bam_pileup_f)__pyx_f_5pysam_9csamtools_pileup_callback), ((void *)__pyx_v_callback));
+      __pyx_v_buf = bam_plbuf_init(((bam_pileup_f)__pyx_f_9csamtools_pileup_callback), ((void *)__pyx_v_callback));
 
-      /* "pysam/csamtools.pyx":1129
+      /* "csamtools.pyx":1129
  *                 bam_fetch(self.samfile.x.bam,
  *                           self.index, rtid, rstart, rend,
  *                           buf, pileup_fetch_callback )             # <<<<<<<<<<<<<<
  * 
  *                 # 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_5pysam_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);
 
-      /* "pysam/csamtools.pyx":1132
+      /* "csamtools.pyx":1132
  * 
  *                 # finalize pileup
  *                 bam_plbuf_push( NULL, buf)             # <<<<<<<<<<<<<<
@@ -11897,7 +11156,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
  */
       bam_plbuf_push(NULL, __pyx_v_buf);
 
-      /* "pysam/csamtools.pyx":1133
+      /* "csamtools.pyx":1133
  *                 # finalize pileup
  *                 bam_plbuf_push( NULL, buf)
  *                 bam_plbuf_destroy(buf)             # <<<<<<<<<<<<<<
@@ -11905,11 +11164,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
  *                 if has_coord:
  */
       bam_plbuf_destroy(__pyx_v_buf);
-      goto __pyx_L8;
+      goto __pyx_L11;
     }
     /*else*/ {
 
-      /* "pysam/csamtools.pyx":1135
+      /* "csamtools.pyx":1135
  *                 bam_plbuf_destroy(buf)
  *             else:
  *                 if has_coord:             # <<<<<<<<<<<<<<
@@ -11918,7 +11177,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
  */
       if (__pyx_v_has_coord) {
 
-        /* "pysam/csamtools.pyx":1136
+        /* "csamtools.pyx":1136
  *             else:
  *                 if has_coord:
  *                     return IteratorColumnRegion( self,             # <<<<<<<<<<<<<<
@@ -11927,22 +11186,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
  */
         __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));
-
-        /* "pysam/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));
 
-        /* "pysam/csamtools.pyx":1137
+        /* "csamtools.pyx":1137
  *                 if has_coord:
  *                     return IteratorColumnRegion( self,
  *                                                  tid = rtid,             # <<<<<<<<<<<<<<
@@ -11951,13 +11202,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
  */
         __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;
 
-        /* "pysam/csamtools.pyx":1138
+        /* "csamtools.pyx":1138
  *                     return IteratorColumnRegion( self,
  *                                                  tid = rtid,
  *                                                  start = rstart,             # <<<<<<<<<<<<<<
@@ -11966,13 +11214,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
  */
         __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;
 
-        /* "pysam/csamtools.pyx":1139
+        /* "csamtools.pyx":1139
  *                                                  tid = rtid,
  *                                                  start = rstart,
  *                                                  end = rend,             # <<<<<<<<<<<<<<
@@ -11981,23 +11226,29 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
  */
         __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_5pysam_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*/ {
 
-        /* "pysam/csamtools.pyx":1142
+        /* "csamtools.pyx":1142
  *                                                  **kwargs )
  *                 else:
  *                     return IteratorColumnAllRefs(self, **kwargs )             # <<<<<<<<<<<<<<
@@ -12006,41 +11257,38 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
  */
         __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_5pysam_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*/ {
 
-    /* "pysam/csamtools.pyx":1145
+    /* "csamtools.pyx":1145
  * 
  *         else:
  *             raise NotImplementedError( "pileup of samfiles not implemented yet" )             # <<<<<<<<<<<<<<
  * 
  *     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;
@@ -12051,28 +11299,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_26pileup(struct __pyx_obj_5
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __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_5pysam_9csamtools_7Samfile_29close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_28close[] = "Samfile.close(self)\n\n        closes the :class:`pysam.Samfile`.";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7Samfile_28close(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1147
+/* "csamtools.pyx":1147
  *             raise NotImplementedError( "pileup of samfiles not implemented yet" )
  * 
  *     def close( self ):             # <<<<<<<<<<<<<<
@@ -12080,53 +11317,55 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_29close(PyObject *__pyx_v_s
  *         closes the :class:`pysam.Samfile`.'''
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_28close(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1150
+  /* "csamtools.pyx":1150
  *         '''
  *         closes the :class:`pysam.Samfile`.'''
  *         if self.samfile != NULL:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":1151
+    /* "csamtools.pyx":1151
  *         closes the :class:`pysam.Samfile`.'''
  *         if self.samfile != NULL:
  *             samclose( self.samfile )             # <<<<<<<<<<<<<<
  *             bam_index_destroy(self.index);
  *             self.samfile = NULL
  */
-    samclose(__pyx_v_self->samfile);
+    samclose(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile);
 
-    /* "pysam/csamtools.pyx":1152
+    /* "csamtools.pyx":1152
  *         if self.samfile != NULL:
  *             samclose( self.samfile )
  *             bam_index_destroy(self.index);             # <<<<<<<<<<<<<<
  *             self.samfile = NULL
  * 
  */
-    bam_index_destroy(__pyx_v_self->index);
+    bam_index_destroy(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index);
 
-    /* "pysam/csamtools.pyx":1153
+    /* "csamtools.pyx":1153
  *             samclose( self.samfile )
  *             bam_index_destroy(self.index);
  *             self.samfile = NULL             # <<<<<<<<<<<<<<
  * 
  *     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);
@@ -12135,16 +11374,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_28close(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_5pysam_9csamtools_7Samfile_31__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5pysam_9csamtools_7Samfile_31__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_5pysam_9csamtools_7Samfile_30__dealloc__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "pysam/csamtools.pyx":1155
+/* "csamtools.pyx":1155
  *             self.samfile = NULL
  * 
  *     def __dealloc__( self ):             # <<<<<<<<<<<<<<
@@ -12152,7 +11382,8 @@ static void __pyx_pw_5pysam_9csamtools_7Samfile_31__dealloc__(PyObject *__pyx_v_
  *         # note: no doc string
  */
 
-static void __pyx_pf_5pysam_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_5pysam_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;
@@ -12161,57 +11392,57 @@ static void __pyx_pf_5pysam_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_5
   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);
 
-  /* "pysam/csamtools.pyx":1159
+  /* "csamtools.pyx":1159
  *         # note: no doc string
  *         # note: __del__ is not called.
  *         self.close()             # <<<<<<<<<<<<<<
  *         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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":1160
+  /* "csamtools.pyx":1160
  *         # note: __del__ is not called.
  *         self.close()
  *         bam_destroy1(self.b)             # <<<<<<<<<<<<<<
  *         if self._filename != NULL: free( self._filename )
  * 
  */
-  bam_destroy1(__pyx_v_self->b);
+  bam_destroy1(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b);
 
-  /* "pysam/csamtools.pyx":1161
+  /* "csamtools.pyx":1161
  *         self.close()
  *         bam_destroy1(self.b)
  *         if self._filename != NULL: free( self._filename )             # <<<<<<<<<<<<<<
  * 
  *     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:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
   __Pyx_RefNannyFinishContext();
 }
 
-/* "pysam/csamtools.pyx":1163
+/* "csamtools.pyx":1163
  *         if self._filename != NULL: free( self._filename )
  * 
  *     cpdef int write( self, AlignedRead read ) except -1:             # <<<<<<<<<<<<<<
@@ -12219,8 +11450,8 @@ static void __pyx_pf_5pysam_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_5
  *         write a single :class:`pysam.AlignedRead` to disk.
  */
 
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
-static int __pyx_f_5pysam_9csamtools_7Samfile_write(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_read, int __pyx_skip_dispatch) {
+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
   PyObject *__pyx_t_1 = NULL;
@@ -12233,7 +11464,7 @@ static int __pyx_f_5pysam_9csamtools_7Samfile_write(struct __pyx_obj_5pysam_9csa
   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)) ;
@@ -12241,9 +11472,9 @@ static int __pyx_f_5pysam_9csamtools_7Samfile_write(struct __pyx_obj_5pysam_9csa
   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_5pysam_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));
@@ -12259,7 +11490,7 @@ static int __pyx_f_5pysam_9csamtools_7Samfile_write(struct __pyx_obj_5pysam_9csa
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   }
 
-  /* "pysam/csamtools.pyx":1169
+  /* "csamtools.pyx":1169
  *         returns the number of bytes written.
  *         '''
  *         if not self._isOpen():             # <<<<<<<<<<<<<<
@@ -12276,7 +11507,7 @@ static int __pyx_f_5pysam_9csamtools_7Samfile_write(struct __pyx_obj_5pysam_9csa
   __pyx_t_6 = (!__pyx_t_5);
   if (__pyx_t_6) {
 
-    /* "pysam/csamtools.pyx":1170
+    /* "csamtools.pyx":1170
  *         '''
  *         if not self._isOpen():
  *             return 0             # <<<<<<<<<<<<<<
@@ -12289,7 +11520,7 @@ static int __pyx_f_5pysam_9csamtools_7Samfile_write(struct __pyx_obj_5pysam_9csa
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":1172
+  /* "csamtools.pyx":1172
  *             return 0
  * 
  *         return samwrite( self.samfile, read._delegate )             # <<<<<<<<<<<<<<
@@ -12305,7 +11536,7 @@ static int __pyx_f_5pysam_9csamtools_7Samfile_write(struct __pyx_obj_5pysam_9csa
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_WriteUnraisable("pysam.csamtools.Samfile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_WriteUnraisable("csamtools.Samfile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -12313,24 +11544,7 @@ static int __pyx_f_5pysam_9csamtools_7Samfile_write(struct __pyx_obj_5pysam_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
-static char __pyx_doc_5pysam_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_5pysam_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_5pysam_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_32write(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_read));
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1163
+/* "csamtools.pyx":1163
  *         if self._filename != NULL: free( self._filename )
  * 
  *     cpdef int write( self, AlignedRead read ) except -1:             # <<<<<<<<<<<<<<
@@ -12338,7 +11552,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_33write(PyObject *__pyx_v_s
  *         write a single :class:`pysam.AlignedRead` to disk.
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_32write(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_5pysam_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;
@@ -12346,10 +11562,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_32write(struct __pyx_obj_5p
   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_5pysam_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;
@@ -12359,7 +11576,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_32write(struct __pyx_obj_5p
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -12368,19 +11585,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_32write(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_35__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_34__enter__[] = "Samfile.__enter__(self)";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7Samfile_34__enter__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1174
+/* "csamtools.pyx":1174
  *         return samwrite( self.samfile, read._delegate )
  * 
  *     def __enter__(self):             # <<<<<<<<<<<<<<
@@ -12388,14 +11593,16 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_35__enter__(PyObject *__pyx
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_34__enter__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1175
+  /* "csamtools.pyx":1175
  * 
  *     def __enter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -12403,8 +11610,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_34__enter__(struct __pyx_ob
  *     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);
@@ -12415,23 +11622,36 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_34__enter__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_37__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_36__exit__[] = "Samfile.__exit__(self, exc_type, exc_value, traceback)";
-static PyObject *__pyx_pw_5pysam_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;
-  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__exc_type,&__pyx_n_s__exc_value,&__pyx_n_s__traceback,0};
     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);
@@ -12439,23 +11659,26 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_37__exit__(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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_type)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_type);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_value)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_value);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__traceback)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__traceback);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       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;
@@ -12472,50 +11695,26 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_37__exit__(PyObject *__pyx_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_36__exit__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_traceback);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
 
-/* "pysam/csamtools.pyx":1177
- *         return self
- * 
- *     def __exit__(self, exc_type, exc_value, traceback):             # <<<<<<<<<<<<<<
- *         self.close()
- *         return False
- */
-
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_36__exit__(struct __pyx_obj_5pysam_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);
-
-  /* "pysam/csamtools.pyx":1178
+  /* "csamtools.pyx":1178
  * 
  *     def __exit__(self, exc_type, exc_value, traceback):
  *         self.close()             # <<<<<<<<<<<<<<
  *         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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":1179
+  /* "csamtools.pyx":1179
  *     def __exit__(self, exc_type, exc_value, traceback):
  *         self.close()
  *         return False             # <<<<<<<<<<<<<<
@@ -12534,7 +11733,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_36__exit__(struct __pyx_obj
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -12543,18 +11742,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_36__exit__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_8filename_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_8filename___get__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1188
+/* "csamtools.pyx":1188
  *     property filename:
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -12562,7 +11750,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_8filename_1__get__(PyObject
  *             return self._filename
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8filename___get__(struct __pyx_obj_5pysam_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;
@@ -12573,17 +11762,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8filename___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], 1188);
 
-  /* "pysam/csamtools.pyx":1189
+  /* "csamtools.pyx":1189
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             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);
@@ -12597,11 +11786,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8filename___get__(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 = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":1190
+  /* "csamtools.pyx":1190
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             return self._filename             # <<<<<<<<<<<<<<
@@ -12609,7 +11798,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8filename___get__(struct __
  *     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;
@@ -12620,7 +11809,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8filename___get__(struct __
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -12629,18 +11818,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8filename___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_11nreferences_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_11nreferences_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_11nreferences___get__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1194
+/* "csamtools.pyx":1194
  *     property nreferences:
  *         '''number of :term:`reference` sequences in the file.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -12648,7 +11826,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_11nreferences_1__get__(PyOb
  *             return self.samfile.header.n_targets
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_11nreferences___get__(struct __pyx_obj_5pysam_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;
@@ -12659,17 +11838,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_11nreferences___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], 1194);
 
-  /* "pysam/csamtools.pyx":1195
+  /* "csamtools.pyx":1195
  *         '''number of :term:`reference` sequences in the file.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             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);
@@ -12683,11 +11862,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_11nreferences___get__(struc
     __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:;
 
-  /* "pysam/csamtools.pyx":1196
+  /* "csamtools.pyx":1196
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             return self.samfile.header.n_targets             # <<<<<<<<<<<<<<
@@ -12695,7 +11874,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_11nreferences___get__(struc
  *     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;
@@ -12706,7 +11885,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_11nreferences___get__(struc
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.nreferences.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.nreferences.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -12715,18 +11894,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_11nreferences___get__(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_10references_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_10references_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_10references___get__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1200
+/* "csamtools.pyx":1200
  *     property references:
  *         """tuple with the names of :term:`reference` sequences."""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -12734,7 +11902,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_10references_1__get__(PyObj
  *             t = []
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10references___get__(struct __pyx_obj_5pysam_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;
@@ -12749,17 +11918,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10references___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], 1200);
 
-  /* "pysam/csamtools.pyx":1201
+  /* "csamtools.pyx":1201
  *         """tuple with the names of :term:`reference` sequences."""
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             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);
@@ -12773,11 +11942,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10references___get__(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 = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":1202
+  /* "csamtools.pyx":1202
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             t = []             # <<<<<<<<<<<<<<
@@ -12785,34 +11954,37 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10references___get__(struct
  *                 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;
 
-  /* "pysam/csamtools.pyx":1203
+  /* "csamtools.pyx":1203
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
  *                 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++) {
 
-    /* "pysam/csamtools.pyx":1204
+    /* "csamtools.pyx":1204
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( _charptr_to_str(self.samfile.header.target_name[x]) )             # <<<<<<<<<<<<<<
  *             return tuple(t)
  * 
  */
-    __pyx_t_2 = __pyx_f_5pysam_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;
   }
 
-  /* "pysam/csamtools.pyx":1205
+  /* "csamtools.pyx":1205
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( _charptr_to_str(self.samfile.header.target_name[x]) )
  *             return tuple(t)             # <<<<<<<<<<<<<<
@@ -12820,6 +11992,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10references___get__(struct
  *     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);
@@ -12831,7 +12006,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10references___get__(struct
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.references.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.references.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_t);
@@ -12841,18 +12016,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_10references___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7lengths_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7lengths_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_7lengths___get__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1211
+/* "csamtools.pyx":1211
  *         :attr:`pysam.Samfile.references`
  *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -12860,7 +12024,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_7lengths_1__get__(PyObject
  *             t = []
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_5pysam_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;
@@ -12875,17 +12040,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_7lengths___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], 1211);
 
-  /* "pysam/csamtools.pyx":1212
+  /* "csamtools.pyx":1212
  *         """
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             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);
@@ -12899,11 +12064,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_7lengths___get__(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 = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":1213
+  /* "csamtools.pyx":1213
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             t = []             # <<<<<<<<<<<<<<
@@ -12911,34 +12076,37 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_7lengths___get__(struct __p
  *                 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;
 
-  /* "pysam/csamtools.pyx":1214
+  /* "csamtools.pyx":1214
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
  *                 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++) {
 
-    /* "pysam/csamtools.pyx":1215
+    /* "csamtools.pyx":1215
  *             t = []
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( self.samfile.header.target_len[x] )             # <<<<<<<<<<<<<<
  *             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;
   }
 
-  /* "pysam/csamtools.pyx":1216
+  /* "csamtools.pyx":1216
  *             for x from 0 <= x < self.samfile.header.n_targets:
  *                 t.append( self.samfile.header.target_len[x] )
  *             return tuple(t)             # <<<<<<<<<<<<<<
@@ -12946,6 +12114,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_7lengths___get__(struct __p
  *     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);
@@ -12957,7 +12128,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_7lengths___get__(struct __p
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.lengths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.lengths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_t);
@@ -12967,18 +12138,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_7lengths___get__(struct __p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_6mapped_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_6mapped_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_6mapped___get__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1221
+/* "csamtools.pyx":1221
  *         """total number of mapped reads in file.
  *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -12986,7 +12146,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_6mapped_1__get__(PyObject *
  *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_5pysam_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;
@@ -13000,17 +12161,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6mapped___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], 1221);
 
-  /* "pysam/csamtools.pyx":1222
+  /* "csamtools.pyx":1222
  *         """
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             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);
@@ -13024,29 +12185,29 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6mapped___get__(struct __py
     __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:;
 
-  /* "pysam/csamtools.pyx":1223
+  /* "csamtools.pyx":1223
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )             # <<<<<<<<<<<<<<
  * 
  *             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:;
 
-  /* "pysam/csamtools.pyx":1226
+  /* "csamtools.pyx":1226
  * 
  *             cdef int tid
  *             cdef uint32_t total = 0             # <<<<<<<<<<<<<<
@@ -13055,27 +12216,27 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6mapped___get__(struct __py
  */
   __pyx_v_total = 0;
 
-  /* "pysam/csamtools.pyx":1227
+  /* "csamtools.pyx":1227
  *             cdef int tid
  *             cdef uint32_t total = 0
  *             for tid from 0 <= tid < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
  *                 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++) {
 
-    /* "pysam/csamtools.pyx":1228
+    /* "csamtools.pyx":1228
  *             cdef uint32_t total = 0
  *             for tid from 0 <= tid < self.samfile.header.n_targets:
  *                 total += pysam_get_mapped( self.index, tid )             # <<<<<<<<<<<<<<
  *             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));
   }
 
-  /* "pysam/csamtools.pyx":1229
+  /* "csamtools.pyx":1229
  *             for tid from 0 <= tid < self.samfile.header.n_targets:
  *                 total += pysam_get_mapped( self.index, tid )
  *             return total             # <<<<<<<<<<<<<<
@@ -13094,7 +12255,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6mapped___get__(struct __py
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.mapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.mapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -13103,18 +12264,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6mapped___get__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_8unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_8unmapped_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_8unmapped___get__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1234
+/* "csamtools.pyx":1234
  *         """total number of unmapped reads in file.
  *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -13122,7 +12272,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_8unmapped_1__get__(PyObject
  *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj_5pysam_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;
@@ -13136,17 +12287,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8unmapped___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], 1234);
 
-  /* "pysam/csamtools.pyx":1235
+  /* "csamtools.pyx":1235
  *         """
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             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);
@@ -13160,29 +12311,29 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8unmapped___get__(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 = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":1236
+  /* "csamtools.pyx":1236
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )             # <<<<<<<<<<<<<<
  *             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:;
 
-  /* "pysam/csamtools.pyx":1238
+  /* "csamtools.pyx":1238
  *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
  *             cdef int tid
  *             cdef uint32_t total = 0             # <<<<<<<<<<<<<<
@@ -13191,36 +12342,36 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8unmapped___get__(struct __
  */
   __pyx_v_total = 0;
 
-  /* "pysam/csamtools.pyx":1239
+  /* "csamtools.pyx":1239
  *             cdef int tid
  *             cdef uint32_t total = 0
  *             for tid from 0 <= tid < self.samfile.header.n_targets:             # <<<<<<<<<<<<<<
  *                 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++) {
 
-    /* "pysam/csamtools.pyx":1240
+    /* "csamtools.pyx":1240
  *             cdef uint32_t total = 0
  *             for tid from 0 <= tid < self.samfile.header.n_targets:
  *                 total += pysam_get_unmapped( self.index, tid )             # <<<<<<<<<<<<<<
  *             # 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));
   }
 
-  /* "pysam/csamtools.pyx":1242
+  /* "csamtools.pyx":1242
  *                 total += pysam_get_unmapped( self.index, tid )
  *             # get unmapped reads without coordinates
  *             total += pysam_get_unmapped( self.index, -1 )             # <<<<<<<<<<<<<<
  *             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));
 
-  /* "pysam/csamtools.pyx":1243
+  /* "csamtools.pyx":1243
  *             # get unmapped reads without coordinates
  *             total += pysam_get_unmapped( self.index, -1 )
  *             return total             # <<<<<<<<<<<<<<
@@ -13239,7 +12390,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8unmapped___get__(struct __
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -13248,18 +12399,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_8unmapped___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_4text_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_4text___get__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1247
+/* "csamtools.pyx":1247
  *     property text:
  *         '''full contents of the :term:`sam file` header as a string.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -13267,7 +12407,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_4text_1__get__(PyObject *__
  *             return from_string_and_size(self.samfile.header.text, self.samfile.header.l_text)
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4text___get__(struct __pyx_obj_5pysam_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;
@@ -13278,17 +12419,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4text___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], 1247);
 
-  /* "pysam/csamtools.pyx":1248
+  /* "csamtools.pyx":1248
  *         '''full contents of the :term:`sam file` header as a string.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *             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);
@@ -13302,11 +12443,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4text___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 = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":1249
+  /* "csamtools.pyx":1249
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             return from_string_and_size(self.samfile.header.text, self.samfile.header.l_text)             # <<<<<<<<<<<<<<
@@ -13314,7 +12455,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4text___get__(struct __pyx_
  *     property header:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __pyx_f_5pysam_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;
@@ -13325,7 +12466,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4text___get__(struct __pyx_
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -13334,18 +12475,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_4text___get__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_6header_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1255
+/* "csamtools.pyx":1255
  *         a two-level dictionary.
  *         '''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -13353,7 +12483,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_6header_1__get__(PyObject *
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __pyx_obj_5pysam_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;
@@ -13386,17 +12517,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___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], 1255);
 
-  /* "pysam/csamtools.pyx":1256
+  /* "csamtools.pyx":1256
  *         '''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  * 
  *             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);
@@ -13410,11 +12541,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
     __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:;
 
-  /* "pysam/csamtools.pyx":1258
+  /* "csamtools.pyx":1258
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  * 
  *             result = {}             # <<<<<<<<<<<<<<
@@ -13426,29 +12557,29 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
   __pyx_v_result = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":1260
+  /* "csamtools.pyx":1260
  *             result = {}
  * 
  *             if self.samfile.header.text != NULL:             # <<<<<<<<<<<<<<
  *                 # 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) {
 
-    /* "pysam/csamtools.pyx":1262
+    /* "csamtools.pyx":1262
  *             if self.samfile.header.text != NULL:
  *                 # convert to python string (note: call self.text to create 0-terminated string)
  *                 t = self.text             # <<<<<<<<<<<<<<
  *                 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;
 
-    /* "pysam/csamtools.pyx":1263
+    /* "csamtools.pyx":1263
  *                 # convert to python string (note: call self.text to create 0-terminated string)
  *                 t = self.text
  *                 for line in t.split("\n"):             # <<<<<<<<<<<<<<
@@ -13470,20 +12601,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
     }
     __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;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
+      } else if (PyTuple_CheckExact(__pyx_t_2)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
       } else {
         __pyx_t_1 = __pyx_t_6(__pyx_t_2);
         if (unlikely(!__pyx_t_1)) {
@@ -13499,7 +12622,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       __pyx_v_line = __pyx_t_1;
       __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":1264
+      /* "csamtools.pyx":1264
  *                 t = self.text
  *                 for line in t.split("\n"):
  *                     if not line.strip(): continue             # <<<<<<<<<<<<<<
@@ -13515,12 +12638,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       __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:;
 
-      /* "pysam/csamtools.pyx":1265
+      /* "csamtools.pyx":1265
  *                 for line in t.split("\n"):
  *                     if not line.strip(): continue
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line             # <<<<<<<<<<<<<<
@@ -13544,7 +12667,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       }
       #endif
 
-      /* "pysam/csamtools.pyx":1266
+      /* "csamtools.pyx":1266
  *                     if not line.strip(): continue
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  *                     fields = line[1:].split("\t")             # <<<<<<<<<<<<<<
@@ -13563,7 +12686,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       __pyx_v_fields = __pyx_t_1;
       __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":1267
+      /* "csamtools.pyx":1267
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  *                     fields = line[1:].split("\t")
  *                     record = fields[0]             # <<<<<<<<<<<<<<
@@ -13576,7 +12699,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       __pyx_v_record = __pyx_t_1;
       __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":1268
+      /* "csamtools.pyx":1268
  *                     fields = line[1:].split("\t")
  *                     record = fields[0]
  *                     assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)             # <<<<<<<<<<<<<<
@@ -13586,11 +12709,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       #ifndef CYTHON_WITHOUT_ASSERTIONS
       __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); 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_t_3 = (__Pyx_PySequence_Contains(__pyx_v_record, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __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);
@@ -13606,36 +12729,37 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       }
       #endif
 
-      /* "pysam/csamtools.pyx":1271
+      /* "csamtools.pyx":1271
  * 
  *                     # treat comments
  *                     if record == "CO":             # <<<<<<<<<<<<<<
  *                         if record not in result: result[record] = []
  *                         result[record].append( "\t".join( fields[1:] ) )
  */
-      __pyx_t_7 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_3) {
 
-        /* "pysam/csamtools.pyx":1272
+        /* "csamtools.pyx":1272
  *                     # treat comments
  *                     if record == "CO":
  *                         if record not in result: result[record] = []             # <<<<<<<<<<<<<<
  *                         result[record].append( "\t".join( fields[1:] ) )
  *                         continue
  */
-        __pyx_t_3 = (__Pyx_PyDict_Contains(__pyx_v_record, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        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:;
 
-        /* "pysam/csamtools.pyx":1273
+        /* "csamtools.pyx":1273
  *                     if record == "CO":
  *                         if record not in result: result[record] = []
  *                         result[record].append( "\t".join( fields[1:] ) )             # <<<<<<<<<<<<<<
@@ -13649,7 +12773,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __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;
@@ -13663,19 +12787,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
-        /* "pysam/csamtools.pyx":1274
+        /* "csamtools.pyx":1274
  *                         if record not in result: result[record] = []
  *                         result[record].append( "\t".join( fields[1:] ) )
  *                         continue             # <<<<<<<<<<<<<<
  * 
  *                     # 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:;
 
-      /* "pysam/csamtools.pyx":1277
+      /* "csamtools.pyx":1277
  * 
  *                     # the following is clumsy as generators do not work?
  *                     x = {}             # <<<<<<<<<<<<<<
@@ -13688,7 +12812,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       __pyx_v_x = __pyx_t_9;
       __pyx_t_9 = 0;
 
-      /* "pysam/csamtools.pyx":1278
+      /* "csamtools.pyx":1278
  *                     # the following is clumsy as generators do not work?
  *                     x = {}
  *                     for field in fields[1:]:             # <<<<<<<<<<<<<<
@@ -13707,20 +12831,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       }
       __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;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_8)) {
+          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++;
+        } else if (PyTuple_CheckExact(__pyx_t_8)) {
           if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++;
         } else {
           __pyx_t_9 = __pyx_t_11(__pyx_t_8);
           if (unlikely(!__pyx_t_9)) {
@@ -13736,7 +12852,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __pyx_v_field = __pyx_t_9;
         __pyx_t_9 = 0;
 
-        /* "pysam/csamtools.pyx":1279
+        /* "csamtools.pyx":1279
  *                     x = {}
  *                     for field in fields[1:]:
  *                         key, value = field.split(":",1)             # <<<<<<<<<<<<<<
@@ -13750,52 +12866,45 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
           PyObject* sequence = __pyx_t_7;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          Py_ssize_t size = Py_SIZE(sequence);
-          #else
-          Py_ssize_t size = PySequence_Size(sequence);
-          #endif
-          if (unlikely(size != 2)) {
-            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          }
-          #if CYTHON_COMPILING_IN_CPYTHON
           if (likely(PyTuple_CheckExact(sequence))) {
+            if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+              if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+              else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            }
             __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
             __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
           } else {
+            if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+              if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+              else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            }
             __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
             __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
           }
           __Pyx_INCREF(__pyx_t_9);
           __Pyx_INCREF(__pyx_t_1);
-          #else
-          __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        } else
-        {
+        } else {
           Py_ssize_t index = -1;
           __pyx_t_12 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __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_t_13 = NULL;
           __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;
-          __pyx_t_13 = NULL;
-          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+          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;
@@ -13804,7 +12913,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __pyx_v_value = __pyx_t_1;
         __pyx_t_1 = 0;
 
-        /* "pysam/csamtools.pyx":1282
+        /* "csamtools.pyx":1282
  *                         # uppercase keys must be valid
  *                         # lowercase are permitted for user fields
  *                         if key in VALID_HEADER_FIELDS[record]:             # <<<<<<<<<<<<<<
@@ -13816,11 +12925,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __pyx_t_1 = PyObject_GetItem(__pyx_t_7, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_v_key, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         if (__pyx_t_3) {
 
-          /* "pysam/csamtools.pyx":1283
+          /* "csamtools.pyx":1283
  *                         # lowercase are permitted for user fields
  *                         if key in VALID_HEADER_FIELDS[record]:
  *                             x[key] = VALID_HEADER_FIELDS[record][key](value)             # <<<<<<<<<<<<<<
@@ -13836,7 +12945,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
           __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);
@@ -13846,10 +12955,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
           __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;
         }
 
-        /* "pysam/csamtools.pyx":1284
+        /* "csamtools.pyx":1284
  *                         if key in VALID_HEADER_FIELDS[record]:
  *                             x[key] = VALID_HEADER_FIELDS[record][key](value)
  *                         elif not key.isupper():             # <<<<<<<<<<<<<<
@@ -13866,7 +12975,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __pyx_t_4 = (!__pyx_t_3);
         if (__pyx_t_4) {
 
-          /* "pysam/csamtools.pyx":1285
+          /* "csamtools.pyx":1285
  *                             x[key] = VALID_HEADER_FIELDS[record][key](value)
  *                         elif not key.isupper():
  *                             x[key] = value             # <<<<<<<<<<<<<<
@@ -13874,11 +12983,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
  *                             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*/ {
 
-          /* "pysam/csamtools.pyx":1287
+          /* "csamtools.pyx":1287
  *                             x[key] = value
  *                         else:
  *                             raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )             # <<<<<<<<<<<<<<
@@ -13886,7 +12995,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
  *                     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);
@@ -13897,7 +13006,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
           __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;
@@ -13908,11 +13017,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
           __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;
 
-      /* "pysam/csamtools.pyx":1289
+      /* "csamtools.pyx":1289
  *                             raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )
  * 
  *                     if VALID_HEADER_TYPES[record] == dict:             # <<<<<<<<<<<<<<
@@ -13924,23 +13033,27 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       __pyx_t_9 = PyObject_GetItem(__pyx_t_8, __pyx_v_record); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)((PyObject*)(&PyDict_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)((PyObject*)(&PyDict_Type))), Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       if (__pyx_t_4) {
 
-        /* "pysam/csamtools.pyx":1290
+        /* "csamtools.pyx":1290
  * 
  *                     if VALID_HEADER_TYPES[record] == dict:
  *                         if record in result:             # <<<<<<<<<<<<<<
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )
  *                         result[record] = x
  */
-        __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_record, ((PyObject *)__pyx_v_result), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        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) {
 
-          /* "pysam/csamtools.pyx":1291
+          /* "csamtools.pyx":1291
  *                     if VALID_HEADER_TYPES[record] == dict:
  *                         if record in result:
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )             # <<<<<<<<<<<<<<
@@ -13950,7 +13063,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
           __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;
@@ -13960,11 +13073,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
           __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:;
 
-        /* "pysam/csamtools.pyx":1292
+        /* "csamtools.pyx":1292
  *                         if record in result:
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )
  *                         result[record] = x             # <<<<<<<<<<<<<<
@@ -13972,10 +13085,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
  *                         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;
       }
 
-      /* "pysam/csamtools.pyx":1293
+      /* "csamtools.pyx":1293
  *                             raise ValueError( "multiple '%s' lines are not permitted" % record )
  *                         result[record] = x
  *                     elif VALID_HEADER_TYPES[record] == list:             # <<<<<<<<<<<<<<
@@ -13987,30 +13100,34 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       __pyx_t_9 = PyObject_GetItem(__pyx_t_8, __pyx_v_record); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)((PyObject*)(&PyList_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)((PyObject*)(&PyList_Type))), Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       if (__pyx_t_4) {
 
-        /* "pysam/csamtools.pyx":1294
+        /* "csamtools.pyx":1294
  *                         result[record] = x
  *                     elif VALID_HEADER_TYPES[record] == list:
  *                         if record not in result: result[record] = []             # <<<<<<<<<<<<<<
  *                         result[record].append( x )
  * 
  */
-        __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_record, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        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:;
 
-        /* "pysam/csamtools.pyx":1295
+        /* "csamtools.pyx":1295
  *                     elif VALID_HEADER_TYPES[record] == list:
  *                         if record not in result: result[record] = []
  *                         result[record].append( x )             # <<<<<<<<<<<<<<
@@ -14023,24 +13140,27 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __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;
 
-    /* "pysam/csamtools.pyx":1303
+    /* "csamtools.pyx":1303
  *                 # SQ lines, the SQ information is not part of the textual header and thus
  *                 # are missing from the output. See issue 84.
  *                 if "SQ" not in result:             # <<<<<<<<<<<<<<
  *                     sq = []
  *                     for ref, length in zip( self.references, self.lengths ):
  */
-    __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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) {
 
-      /* "pysam/csamtools.pyx":1304
+      /* "csamtools.pyx":1304
  *                 # are missing from the output. See issue 84.
  *                 if "SQ" not in result:
  *                     sq = []             # <<<<<<<<<<<<<<
@@ -14048,23 +13168,23 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
  *                         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;
 
-      /* "pysam/csamtools.pyx":1305
+      /* "csamtools.pyx":1305
  *                 if "SQ" not in result:
  *                     sq = []
  *                     for ref, length in zip( self.references, self.lengths ):             # <<<<<<<<<<<<<<
  *                         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);
@@ -14084,20 +13204,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       }
       __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;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_8)) {
+          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
+        } else if (PyTuple_CheckExact(__pyx_t_8)) {
           if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
         } else {
           __pyx_t_9 = __pyx_t_6(__pyx_t_8);
           if (unlikely(!__pyx_t_9)) {
@@ -14111,52 +13223,45 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         }
         if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
           PyObject* sequence = __pyx_t_9;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          Py_ssize_t size = Py_SIZE(sequence);
-          #else
-          Py_ssize_t size = PySequence_Size(sequence);
-          #endif
-          if (unlikely(size != 2)) {
-            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          }
-          #if CYTHON_COMPILING_IN_CPYTHON
           if (likely(PyTuple_CheckExact(sequence))) {
+            if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+              if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+              else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            }
             __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
             __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
           } else {
+            if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+              if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+              else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            }
             __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
             __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
           }
           __Pyx_INCREF(__pyx_t_2);
           __Pyx_INCREF(__pyx_t_7);
-          #else
-          __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        } else
-        {
+        } else {
           Py_ssize_t index = -1;
           __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __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_t_13 = NULL;
           __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;
-          __pyx_t_13 = NULL;
-          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+          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;
@@ -14165,13 +13270,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
         __pyx_v_length = __pyx_t_7;
         __pyx_t_7 = 0;
 
-        /* "pysam/csamtools.pyx":1306
+        /* "csamtools.pyx":1306
  *                     sq = []
  *                     for ref, length in zip( self.references, self.lengths ):
  *                         sq.append( {'LN': length, 'SN': ref } )             # <<<<<<<<<<<<<<
  *                     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;}
@@ -14181,7 +13289,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
       }
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-      /* "pysam/csamtools.pyx":1307
+      /* "csamtools.pyx":1307
  *                     for ref, length in zip( self.references, self.lengths ):
  *                         sq.append( {'LN': length, 'SN': ref } )
  *                     result["SQ"] = sq             # <<<<<<<<<<<<<<
@@ -14189,14 +13297,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
  *             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:;
 
-  /* "pysam/csamtools.pyx":1309
+  /* "csamtools.pyx":1309
  *                     result["SQ"] = sq
  * 
  *             return result             # <<<<<<<<<<<<<<
@@ -14217,7 +13325,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_result);
@@ -14238,40 +13346,63 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_6header___get__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_39_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_38_buildLine[] = "Samfile._buildLine(self, fields, record)\nbuild a header line from *fields* dictionary for *record*";
-static PyObject *__pyx_pw_5pysam_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;
-  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fields,&__pyx_n_s__record,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fields)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fields);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       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;
@@ -14286,44 +13417,12 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_39_buildLine(PyObject *__py
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Samfile._buildLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile._buildLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self), __pyx_v_fields, __pyx_v_record);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
 
-/* "pysam/csamtools.pyx":1311
- *             return result
- * 
- *     def _buildLine( self, fields, record ):             # <<<<<<<<<<<<<<
- *         '''build a header line from *fields* dictionary for *record*'''
- * 
- */
-
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct __pyx_obj_5pysam_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);
-
-  /* "pysam/csamtools.pyx":1315
+  /* "csamtools.pyx":1315
  * 
  *         # TODO: add checking for field and sort order
  *         line = ["@%s" % record ]             # <<<<<<<<<<<<<<
@@ -14333,37 +13432,38 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
   __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;
   __pyx_v_line = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":1317
+  /* "csamtools.pyx":1317
  *         line = ["@%s" % record ]
  *         # comment
  *         if record == "CO":             # <<<<<<<<<<<<<<
  *             line.append( fields )
  *         # user tags
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __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 = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":1318
+    /* "csamtools.pyx":1318
  *         # comment
  *         if record == "CO":
  *             line.append( fields )             # <<<<<<<<<<<<<<
  *         # 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;
   }
 
-  /* "pysam/csamtools.pyx":1320
+  /* "csamtools.pyx":1320
  *             line.append( fields )
  *         # user tags
  *         elif record.islower():             # <<<<<<<<<<<<<<
@@ -14379,7 +13479,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":1321
+    /* "csamtools.pyx":1321
  *         # user tags
  *         elif record.islower():
  *             for key in sorted(fields):             # <<<<<<<<<<<<<<
@@ -14387,7 +13487,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
  *         # 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);
@@ -14404,20 +13504,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
     }
     __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;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+      } else if (PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
       } else {
         __pyx_t_2 = __pyx_t_6(__pyx_t_1);
         if (unlikely(!__pyx_t_2)) {
@@ -14433,17 +13525,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
       __pyx_v_key = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":1322
+      /* "csamtools.pyx":1322
  *         elif record.islower():
  *             for key in sorted(fields):
  *                 line.append( "%s:%s" % (key, str(fields[key])))             # <<<<<<<<<<<<<<
  *         # 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;
@@ -14451,7 +13546,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
       __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);
@@ -14465,11 +13560,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
       __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*/ {
 
-    /* "pysam/csamtools.pyx":1326
+    /* "csamtools.pyx":1326
  *         else:
  *             # write fields of the specification
  *             for key in VALID_HEADER_ORDER[record]:             # <<<<<<<<<<<<<<
@@ -14491,20 +13586,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
     }
     __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;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+      } else if (PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
       } else {
         __pyx_t_2 = __pyx_t_6(__pyx_t_1);
         if (unlikely(!__pyx_t_2)) {
@@ -14520,27 +13607,30 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
       __pyx_v_key = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":1327
+      /* "csamtools.pyx":1327
  *             # write fields of the specification
  *             for key in VALID_HEADER_ORDER[record]:
  *                 if key in fields:             # <<<<<<<<<<<<<<
  *                     line.append( "%s:%s" % (key, str(fields[key])))
  *             # write user fields
  */
-      __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_v_key, __pyx_v_fields, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = ((PySequence_Contains(__pyx_v_fields, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_3) {
 
-        /* "pysam/csamtools.pyx":1328
+        /* "csamtools.pyx":1328
  *             for key in VALID_HEADER_ORDER[record]:
  *                 if key in fields:
  *                     line.append( "%s:%s" % (key, str(fields[key])))             # <<<<<<<<<<<<<<
  *             # 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;
@@ -14548,7 +13638,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
         __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);
@@ -14560,13 +13650,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
         __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;
 
-    /* "pysam/csamtools.pyx":1330
+    /* "csamtools.pyx":1330
  *                     line.append( "%s:%s" % (key, str(fields[key])))
  *             # write user fields
  *             for key in fields:             # <<<<<<<<<<<<<<
@@ -14582,20 +13672,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
       __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;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
+      } else if (PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
       } else {
         __pyx_t_2 = __pyx_t_6(__pyx_t_1);
         if (unlikely(!__pyx_t_2)) {
@@ -14611,7 +13693,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
       __pyx_v_key = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":1331
+      /* "csamtools.pyx":1331
  *             # write user fields
  *             for key in fields:
  *                 if not key.isupper():             # <<<<<<<<<<<<<<
@@ -14628,17 +13710,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
       __pyx_t_8 = (!__pyx_t_3);
       if (__pyx_t_8) {
 
-        /* "pysam/csamtools.pyx":1332
+        /* "csamtools.pyx":1332
  *             for key in fields:
  *                 if not key.isupper():
  *                     line.append( "%s:%s" % (key, str(fields[key])))             # <<<<<<<<<<<<<<
  * 
  *         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;
@@ -14646,7 +13731,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
         __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);
@@ -14658,15 +13743,15 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
         __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:;
 
-  /* "pysam/csamtools.pyx":1334
+  /* "csamtools.pyx":1334
  *                     line.append( "%s:%s" % (key, str(fields[key])))
  * 
  *         return "\t".join( line )             # <<<<<<<<<<<<<<
@@ -14677,7 +13762,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
   __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));
@@ -14695,7 +13780,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile._buildLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile._buildLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_line);
@@ -14706,7 +13791,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1336
+/* "csamtools.pyx":1336
  *         return "\t".join( line )
  * 
  *     cdef bam_header_t * _buildHeader( self, new_header ):             # <<<<<<<<<<<<<<
@@ -14714,7 +13799,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED
  * 
  */
 
-static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_new_header) {
+static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_new_header) {
   PyObject *__pyx_v_lines = NULL;
   bam_header_t *__pyx_v_dest;
   PyObject *__pyx_v_record = NULL;
@@ -14754,10 +13839,10 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   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);
 
-  /* "pysam/csamtools.pyx":1342
+  /* "csamtools.pyx":1342
  *         '''
  * 
  *         lines = []             # <<<<<<<<<<<<<<
@@ -14765,11 +13850,11 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  *         # 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;
 
-  /* "pysam/csamtools.pyx":1349
+  /* "csamtools.pyx":1349
  *         cdef bam_header_t * dest
  * 
  *         dest = bam_header_init()             # <<<<<<<<<<<<<<
@@ -14778,7 +13863,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  */
   __pyx_v_dest = bam_header_init();
 
-  /* "pysam/csamtools.pyx":1352
+  /* "csamtools.pyx":1352
  * 
  *         # first: defined tags
  *         for record in VALID_HEADERS:             # <<<<<<<<<<<<<<
@@ -14797,20 +13882,12 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   }
   __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;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
+    } else if (PyTuple_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
     } else {
       __pyx_t_1 = __pyx_t_4(__pyx_t_2);
       if (unlikely(!__pyx_t_1)) {
@@ -14826,17 +13903,17 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     __pyx_v_record = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":1353
+    /* "csamtools.pyx":1353
  *         # first: defined tags
  *         for record in VALID_HEADERS:
  *             if record in new_header:             # <<<<<<<<<<<<<<
  *                 ttype = VALID_HEADER_TYPES[record]
  *                 data = new_header[record]
  */
-    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_v_record, __pyx_v_new_header, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = ((PySequence_Contains(__pyx_v_new_header, __pyx_v_record))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_5) {
 
-      /* "pysam/csamtools.pyx":1354
+      /* "csamtools.pyx":1354
  *         for record in VALID_HEADERS:
  *             if record in new_header:
  *                 ttype = VALID_HEADER_TYPES[record]             # <<<<<<<<<<<<<<
@@ -14852,7 +13929,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __pyx_v_ttype = __pyx_t_6;
       __pyx_t_6 = 0;
 
-      /* "pysam/csamtools.pyx":1355
+      /* "csamtools.pyx":1355
  *             if record in new_header:
  *                 ttype = VALID_HEADER_TYPES[record]
  *                 data = new_header[record]             # <<<<<<<<<<<<<<
@@ -14865,7 +13942,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __pyx_v_data = __pyx_t_6;
       __pyx_t_6 = 0;
 
-      /* "pysam/csamtools.pyx":1356
+      /* "csamtools.pyx":1356
  *                 ttype = VALID_HEADER_TYPES[record]
  *                 data = new_header[record]
  *                 if type( data ) != type( ttype() ):             # <<<<<<<<<<<<<<
@@ -14874,13 +13951,14 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  */
       __pyx_t_6 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(__pyx_t_6)), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(__pyx_t_6)), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_5) {
 
-        /* "pysam/csamtools.pyx":1357
+        /* "csamtools.pyx":1357
  *                 data = new_header[record]
  *                 if type( data ) != type( ttype() ):
  *                     raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )             # <<<<<<<<<<<<<<
@@ -14890,7 +13968,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
         __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);
@@ -14905,7 +13983,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
         __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;
@@ -14919,7 +13997,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       }
       __pyx_L6:;
 
-      /* "pysam/csamtools.pyx":1358
+      /* "csamtools.pyx":1358
  *                 if type( data ) != type( ttype() ):
  *                     raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
  *                 if type( data ) is dict:             # <<<<<<<<<<<<<<
@@ -14929,17 +14007,20 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_data)) == ((PyObject *)((PyObject*)(&PyDict_Type))));
       if (__pyx_t_5) {
 
-        /* "pysam/csamtools.pyx":1359
+        /* "csamtools.pyx":1359
  *                     raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
  *                 if type( data ) is dict:
  *                     lines.append( self._buildLine( data, record ) )             # <<<<<<<<<<<<<<
  *                 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);
@@ -14956,7 +14037,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       }
       /*else*/ {
 
-        /* "pysam/csamtools.pyx":1361
+        /* "csamtools.pyx":1361
  *                     lines.append( self._buildLine( data, record ) )
  *                 else:
  *                     for fields in new_header[record]:             # <<<<<<<<<<<<<<
@@ -14975,20 +14056,12 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
         }
         __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;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
-          } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_6)) {
+            __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++;
+          } else if (PyTuple_CheckExact(__pyx_t_6)) {
             if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
+            __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++;
           } else {
             __pyx_t_7 = __pyx_t_10(__pyx_t_6);
             if (unlikely(!__pyx_t_7)) {
@@ -15004,17 +14077,20 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
           __pyx_v_fields = __pyx_t_7;
           __pyx_t_7 = 0;
 
-          /* "pysam/csamtools.pyx":1362
+          /* "csamtools.pyx":1362
  *                 else:
  *                     for fields in new_header[record]:
  *                         lines.append( self._buildLine( fields, record ) )             # <<<<<<<<<<<<<<
  * 
  *         # 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);
@@ -15037,7 +14113,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   }
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":1365
+  /* "csamtools.pyx":1365
  * 
  *         # then: user tags (lower case), sorted alphabetically
  *         for record, data in sorted(new_header.items()):             # <<<<<<<<<<<<<<
@@ -15050,7 +14126,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   __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;
@@ -15067,20 +14143,12 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   }
   __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;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
+      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
+    } else if (PyTuple_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
     } else {
       __pyx_t_6 = __pyx_t_4(__pyx_t_2);
       if (unlikely(!__pyx_t_6)) {
@@ -15094,33 +14162,27 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     }
     if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
       PyObject* sequence = __pyx_t_6;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
+        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
       }
       __Pyx_INCREF(__pyx_t_11);
       __Pyx_INCREF(__pyx_t_1);
-      #else
-      __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    } else
-    {
+    } else {
       Py_ssize_t index = -1;
       __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
@@ -15131,13 +14193,12 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L12_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_1);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_12 = NULL;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L13_unpacking_done;
       __pyx_L12_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_12 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L13_unpacking_done:;
     }
@@ -15148,7 +14209,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     __pyx_v_data = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":1366
+    /* "csamtools.pyx":1366
  *         # then: user tags (lower case), sorted alphabetically
  *         for record, data in sorted(new_header.items()):
  *             if record in VALID_HEADERS: continue             # <<<<<<<<<<<<<<
@@ -15157,7 +14218,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  */
     __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADERS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_v_record, __pyx_t_6, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = ((PySequence_Contains(__pyx_t_6, __pyx_v_record))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     if (__pyx_t_5) {
       goto __pyx_L10_continue;
@@ -15165,7 +14226,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     }
     __pyx_L14:;
 
-    /* "pysam/csamtools.pyx":1367
+    /* "csamtools.pyx":1367
  *         for record, data in sorted(new_header.items()):
  *             if record in VALID_HEADERS: continue
  *             if type( data ) is dict:             # <<<<<<<<<<<<<<
@@ -15175,17 +14236,20 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_data)) == ((PyObject *)((PyObject*)(&PyDict_Type))));
     if (__pyx_t_5) {
 
-      /* "pysam/csamtools.pyx":1368
+      /* "csamtools.pyx":1368
  *             if record in VALID_HEADERS: continue
  *             if type( data ) is dict:
  *                 lines.append( self._buildLine( data, record ) )             # <<<<<<<<<<<<<<
  *             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);
@@ -15202,7 +14266,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     }
     /*else*/ {
 
-      /* "pysam/csamtools.pyx":1370
+      /* "csamtools.pyx":1370
  *                 lines.append( self._buildLine( data, record ) )
  *             else:
  *                 for fields in new_header[record]:             # <<<<<<<<<<<<<<
@@ -15221,20 +14285,12 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       }
       __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;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_11 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_1)) {
+          __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++;
+        } else if (PyTuple_CheckExact(__pyx_t_1)) {
           if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_11 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+          __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++;
         } else {
           __pyx_t_11 = __pyx_t_10(__pyx_t_1);
           if (unlikely(!__pyx_t_11)) {
@@ -15250,17 +14306,20 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
         __pyx_v_fields = __pyx_t_11;
         __pyx_t_11 = 0;
 
-        /* "pysam/csamtools.pyx":1371
+        /* "csamtools.pyx":1371
  *             else:
  *                 for fields in new_header[record]:
  *                     lines.append( self._buildLine( fields, record ) )             # <<<<<<<<<<<<<<
  * 
  *         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);
@@ -15281,7 +14340,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   }
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":1373
+  /* "csamtools.pyx":1373
  *                     lines.append( self._buildLine( fields, record ) )
  * 
  *         text = "\n".join(lines) + "\n"             # <<<<<<<<<<<<<<
@@ -15291,7 +14350,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   __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));
@@ -15305,7 +14364,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   __pyx_v_text = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":1374
+  /* "csamtools.pyx":1374
  * 
  *         text = "\n".join(lines) + "\n"
  *         if dest.text != NULL: free( dest.text )             # <<<<<<<<<<<<<<
@@ -15319,7 +14378,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   }
   __pyx_L18:;
 
-  /* "pysam/csamtools.pyx":1375
+  /* "csamtools.pyx":1375
  *         text = "\n".join(lines) + "\n"
  *         if dest.text != NULL: free( dest.text )
  *         dest.text = <char*>calloc( len(text), sizeof(char))             # <<<<<<<<<<<<<<
@@ -15329,7 +14388,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   __pyx_t_3 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_dest->text = ((char *)calloc(__pyx_t_3, (sizeof(char))));
 
-  /* "pysam/csamtools.pyx":1376
+  /* "csamtools.pyx":1376
  *         if dest.text != NULL: free( dest.text )
  *         dest.text = <char*>calloc( len(text), sizeof(char))
  *         dest.l_text = len(text)             # <<<<<<<<<<<<<<
@@ -15339,7 +14398,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   __pyx_t_3 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_dest->l_text = __pyx_t_3;
 
-  /* "pysam/csamtools.pyx":1377
+  /* "csamtools.pyx":1377
  *         dest.text = <char*>calloc( len(text), sizeof(char))
  *         dest.l_text = len(text)
  *         cdef bytes btext = text.encode('ascii')             # <<<<<<<<<<<<<<
@@ -15355,7 +14414,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   __pyx_v_btext = ((PyObject*)__pyx_t_7);
   __pyx_t_7 = 0;
 
-  /* "pysam/csamtools.pyx":1378
+  /* "csamtools.pyx":1378
  *         dest.l_text = len(text)
  *         cdef bytes btext = text.encode('ascii')
  *         strncpy( dest.text, btext, dest.l_text )             # <<<<<<<<<<<<<<
@@ -15365,17 +14424,17 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   __pyx_t_13 = PyBytes_AsString(((PyObject *)__pyx_v_btext)); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   strncpy(__pyx_v_dest->text, __pyx_t_13, __pyx_v_dest->l_text);
 
-  /* "pysam/csamtools.pyx":1382
+  /* "csamtools.pyx":1382
  *         cdef bytes bseqname
  *         # collect targets
  *         if "SQ" in new_header:             # <<<<<<<<<<<<<<
  *             seqs = []
  *             for fields in new_header["SQ"]:
  */
-  __pyx_t_5 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SQ), __pyx_v_new_header, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PySequence_Contains(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":1383
+    /* "csamtools.pyx":1383
  *         # collect targets
  *         if "SQ" in new_header:
  *             seqs = []             # <<<<<<<<<<<<<<
@@ -15383,11 +14442,11 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  *                 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;
 
-    /* "pysam/csamtools.pyx":1384
+    /* "csamtools.pyx":1384
  *         if "SQ" in new_header:
  *             seqs = []
  *             for fields in new_header["SQ"]:             # <<<<<<<<<<<<<<
@@ -15406,20 +14465,12 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     }
     __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;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
+        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
+      } else if (PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
       } else {
         __pyx_t_7 = __pyx_t_4(__pyx_t_1);
         if (unlikely(!__pyx_t_7)) {
@@ -15435,7 +14486,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __pyx_v_fields = __pyx_t_7;
       __pyx_t_7 = 0;
 
-      /* "pysam/csamtools.pyx":1385
+      /* "csamtools.pyx":1385
  *             seqs = []
  *             for fields in new_header["SQ"]:
  *                 try:             # <<<<<<<<<<<<<<
@@ -15449,19 +14500,22 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
         __Pyx_XGOTREF(__pyx_t_16);
         /*try:*/ {
 
-          /* "pysam/csamtools.pyx":1386
+          /* "csamtools.pyx":1386
  *             for fields in new_header["SQ"]:
  *                 try:
  *                     seqs.append( (fields["SN"], fields["LN"] ) )             # <<<<<<<<<<<<<<
  *                 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);
@@ -15481,7 +14535,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
         __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-        /* "pysam/csamtools.pyx":1387
+        /* "csamtools.pyx":1387
  *                 try:
  *                     seqs.append( (fields["SN"], fields["LN"] ) )
  *                 except KeyError:             # <<<<<<<<<<<<<<
@@ -15490,13 +14544,13 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  */
         __pyx_t_17 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
         if (__pyx_t_17) {
-          __Pyx_AddTraceback("pysam.csamtools.Samfile._buildHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
+          __Pyx_AddTraceback("csamtools.Samfile._buildHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
           if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
           __Pyx_GOTREF(__pyx_t_6);
           __Pyx_GOTREF(__pyx_t_2);
           __Pyx_GOTREF(__pyx_t_7);
 
-          /* "pysam/csamtools.pyx":1388
+          /* "csamtools.pyx":1388
  *                     seqs.append( (fields["SN"], fields["LN"] ) )
  *                 except KeyError:
  *                     raise KeyError( "incomplete sequence information in '%s'" % str(fields))             # <<<<<<<<<<<<<<
@@ -15504,7 +14558,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  *             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);
@@ -15515,7 +14569,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
           __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;
@@ -15546,17 +14600,20 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     }
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":1390
+    /* "csamtools.pyx":1390
  *                     raise KeyError( "incomplete sequence information in '%s'" % str(fields))
  * 
  *             dest.n_targets = len(seqs)             # <<<<<<<<<<<<<<
  *             dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )
  *             dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
  */
-    __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_seqs)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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;
 
-    /* "pysam/csamtools.pyx":1391
+    /* "csamtools.pyx":1391
  * 
  *             dest.n_targets = len(seqs)
  *             dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )             # <<<<<<<<<<<<<<
@@ -15565,7 +14622,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  */
     __pyx_v_dest->target_name = ((char **)calloc(__pyx_v_dest->n_targets, (sizeof(char *))));
 
-    /* "pysam/csamtools.pyx":1392
+    /* "csamtools.pyx":1392
  *             dest.n_targets = len(seqs)
  *             dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )
  *             dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )             # <<<<<<<<<<<<<<
@@ -15574,7 +14631,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
  */
     __pyx_v_dest->target_len = ((uint32_t *)calloc(__pyx_v_dest->n_targets, (sizeof(uint32_t))));
 
-    /* "pysam/csamtools.pyx":1394
+    /* "csamtools.pyx":1394
  *             dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
  * 
  *             for x from 0 <= x < dest.n_targets:             # <<<<<<<<<<<<<<
@@ -15584,7 +14641,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
     __pyx_t_19 = __pyx_v_dest->n_targets;
     for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_19; __pyx_v_x++) {
 
-      /* "pysam/csamtools.pyx":1395
+      /* "csamtools.pyx":1395
  * 
  *             for x from 0 <= x < dest.n_targets:
  *                 seqname, seqlen = seqs[x]             # <<<<<<<<<<<<<<
@@ -15595,33 +14652,27 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __Pyx_GOTREF(__pyx_t_1);
       if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
         PyObject* sequence = __pyx_t_1;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        Py_ssize_t size = Py_SIZE(sequence);
-        #else
-        Py_ssize_t size = PySequence_Size(sequence);
-        #endif
-        if (unlikely(size != 2)) {
-          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        #if CYTHON_COMPILING_IN_CPYTHON
         if (likely(PyTuple_CheckExact(sequence))) {
+          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
           __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
           __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
         } else {
+          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
           __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
           __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
         }
         __Pyx_INCREF(__pyx_t_7);
         __Pyx_INCREF(__pyx_t_2);
-        #else
-        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      } else
-      {
+      } else {
         Py_ssize_t index = -1;
         __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_6);
@@ -15632,13 +14683,12 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
         index = 1; __pyx_t_2 = __pyx_t_12(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L34_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_2);
         if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_12 = NULL;
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L35_unpacking_done;
         __pyx_L34_unpacking_failed:;
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        __pyx_t_12 = NULL;
-        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_L35_unpacking_done:;
       }
@@ -15649,7 +14699,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __pyx_v_seqlen = __pyx_t_2;
       __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":1396
+      /* "csamtools.pyx":1396
  *             for x from 0 <= x < dest.n_targets:
  *                 seqname, seqlen = seqs[x]
  *                 dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )             # <<<<<<<<<<<<<<
@@ -15659,7 +14709,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __pyx_t_3 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       (__pyx_v_dest->target_name[__pyx_v_x]) = ((char *)calloc((__pyx_t_3 + 1), (sizeof(char))));
 
-      /* "pysam/csamtools.pyx":1397
+      /* "csamtools.pyx":1397
  *                 seqname, seqlen = seqs[x]
  *                 dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
  *                 bseqname = seqname.encode('ascii')             # <<<<<<<<<<<<<<
@@ -15676,7 +14726,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __pyx_v_bseqname = ((PyObject*)__pyx_t_2);
       __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":1398
+      /* "csamtools.pyx":1398
  *                 dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
  *                 bseqname = seqname.encode('ascii')
  *                 strncpy( dest.target_name[x], bseqname, len(seqname) + 1 )             # <<<<<<<<<<<<<<
@@ -15687,7 +14737,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
       __pyx_t_3 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       strncpy((__pyx_v_dest->target_name[__pyx_v_x]), __pyx_t_13, (__pyx_t_3 + 1));
 
-      /* "pysam/csamtools.pyx":1399
+      /* "csamtools.pyx":1399
  *                 bseqname = seqname.encode('ascii')
  *                 strncpy( dest.target_name[x], bseqname, len(seqname) + 1 )
  *                 dest.target_len[x] = seqlen             # <<<<<<<<<<<<<<
@@ -15701,7 +14751,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   }
   __pyx_L19:;
 
-  /* "pysam/csamtools.pyx":1401
+  /* "csamtools.pyx":1401
  *                 dest.target_len[x] = seqlen
  * 
  *         return dest             # <<<<<<<<<<<<<<
@@ -15720,7 +14770,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_11);
   __Pyx_XDECREF(__pyx_t_18);
-  __Pyx_WriteUnraisable("pysam.csamtools.Samfile._buildHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_WriteUnraisable("csamtools.Samfile._buildHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_lines);
@@ -15739,18 +14789,7 @@ static bam_header_t *__pyx_f_5pysam_9csamtools_7Samfile__buildHeader(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_41__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_41__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1411
+/* "csamtools.pyx":1411
  *     ## Possible solutions: deprecate or open new file handle
  *     ###############################################################
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -15758,7 +14797,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_41__iter__(PyObject *__pyx_
  *         if not self.isbam and self.samfile.header.n_targets == 0:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(struct __pyx_obj_5pysam_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;
@@ -15770,17 +14810,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(struct __pyx_obj
   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);
 
-  /* "pysam/csamtools.pyx":1412
+  /* "csamtools.pyx":1412
  *     ###############################################################
  *     def __iter__(self):
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
  *         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);
@@ -15794,27 +14834,27 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(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 = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":1413
+  /* "csamtools.pyx":1413
  *     def __iter__(self):
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam and self.samfile.header.n_targets == 0:             # <<<<<<<<<<<<<<
  *                 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;
   }
   if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":1414
+    /* "csamtools.pyx":1414
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam and self.samfile.header.n_targets == 0:
  *                 raise NotImplementedError( "can not iterate over samfile without header")             # <<<<<<<<<<<<<<
@@ -15826,11 +14866,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(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 = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":1415
+  /* "csamtools.pyx":1415
  *         if not self.isbam and self.samfile.header.n_targets == 0:
  *                 raise NotImplementedError( "can not iterate over samfile without header")
  *         return self             # <<<<<<<<<<<<<<
@@ -15838,8 +14878,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__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);
@@ -15847,7 +14887,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(struct __pyx_obj
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -15856,7 +14896,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1417
+/* "csamtools.pyx":1417
  *         return self
  * 
  *     cdef bam1_t * getCurrent( self ):             # <<<<<<<<<<<<<<
@@ -15864,14 +14904,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_40__iter__(struct __pyx_obj
  * 
  */
 
-static bam1_t *__pyx_f_5pysam_9csamtools_7Samfile_getCurrent(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self) {
+static bam1_t *__pyx_f_9csamtools_7Samfile_getCurrent(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
   bam1_t *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getCurrent", 0);
+  __Pyx_RefNannySetupContext("getCurrent");
   __Pyx_TraceCall("getCurrent", __pyx_f[0], 1417);
 
-  /* "pysam/csamtools.pyx":1418
+  /* "csamtools.pyx":1418
  * 
  *     cdef bam1_t * getCurrent( self ):
  *         return self.b             # <<<<<<<<<<<<<<
@@ -15888,7 +14928,7 @@ static bam1_t *__pyx_f_5pysam_9csamtools_7Samfile_getCurrent(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1420
+/* "csamtools.pyx":1420
  *         return self.b
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -15896,14 +14936,14 @@ static bam1_t *__pyx_f_5pysam_9csamtools_7Samfile_getCurrent(struct __pyx_obj_5p
  *         cversion of iterator. Used by :class:`pysam.Samfile.IteratorColumn`.
  */
 
-static int __pyx_f_5pysam_9csamtools_7Samfile_cnext(struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_self) {
+static int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1420);
 
-  /* "pysam/csamtools.pyx":1425
+  /* "csamtools.pyx":1425
  *         '''
  *         cdef int ret
  *         return samread(self.samfile, self.b)             # <<<<<<<<<<<<<<
@@ -15920,22 +14960,7 @@ static int __pyx_f_5pysam_9csamtools_7Samfile_cnext(struct __pyx_obj_5pysam_9csa
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_43__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_7Samfile_42__next__[] = "\n        python version of next().\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
-struct wrapperbase __pyx_wrapperbase_5pysam_9csamtools_7Samfile_42__next__;
-#endif
-static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_43__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7Samfile_42__next__(((struct __pyx_obj_5pysam_9csamtools_Samfile *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1427
+/* "csamtools.pyx":1427
  *         return samread(self.samfile, self.b)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -15943,7 +14968,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7Samfile_43__next__(PyObject *__pyx_
  *         python version of next().
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_42__next__(struct __pyx_obj_5pysam_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
@@ -15953,19 +14981,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_42__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], 1427);
 
-  /* "pysam/csamtools.pyx":1432
+  /* "csamtools.pyx":1432
  *         """
  *         cdef int ret
  *         ret = samread(self.samfile, self.b)             # <<<<<<<<<<<<<<
  *         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);
 
-  /* "pysam/csamtools.pyx":1433
+  /* "csamtools.pyx":1433
  *         cdef int ret
  *         ret = samread(self.samfile, self.b)
  *         if (ret > 0):             # <<<<<<<<<<<<<<
@@ -15975,7 +15003,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_42__next__(struct __pyx_obj
   __pyx_t_1 = (__pyx_v_ret > 0);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":1434
+    /* "csamtools.pyx":1434
  *         ret = samread(self.samfile, self.b)
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )             # <<<<<<<<<<<<<<
@@ -15983,16 +15011,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_42__next__(struct __pyx_obj
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_5pysam_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*/ {
 
-    /* "pysam/csamtools.pyx":1436
+    /* "csamtools.pyx":1436
  *             return makeAlignedRead( self.b )
  *         else:
  *             raise StopIteration             # <<<<<<<<<<<<<<
@@ -16002,13 +15030,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_42__next__(struct __pyx_obj
     __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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.Samfile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Samfile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -16017,24 +15045,42 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7Samfile_42__next__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile = 0;
+/* "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;
+  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);
   {
-    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* 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);
@@ -16044,22 +15090,26 @@ static int __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *_
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beg)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beg);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
+        if (likely(values[3])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -16070,7 +15120,7 @@ static int __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *_
         }
       }
       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 (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)) {
@@ -16083,21 +15133,13 @@ static int __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *_
         default: goto __pyx_L5_argtuple_error;
       }
     }
-    __pyx_v_samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[0]);
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
     __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __pyx_v_beg = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     if (values[4]) {
       __pyx_v_reopen = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
-
-      /* "pysam/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);
     }
   }
@@ -16105,39 +15147,13 @@ static int __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(((struct __pyx_obj_5pysam_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;
-}
+  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;}
 
-static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *__pyx_v_self, struct __pyx_obj_5pysam_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;
-  samfile_t *__pyx_t_6;
-  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);
-
-  /* "pysam/csamtools.pyx":1483
+  /* "csamtools.pyx":1483
  *     def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ):
  * 
  *         if not samfile._isOpen():             # <<<<<<<<<<<<<<
@@ -16154,7 +15170,7 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":1484
+    /* "csamtools.pyx":1484
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -16166,11 +15182,11 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(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 = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":1486
+  /* "csamtools.pyx":1486
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         if not samfile._hasIndex():             # <<<<<<<<<<<<<<
@@ -16187,7 +15203,7 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":1487
+    /* "csamtools.pyx":1487
  * 
  *         if not samfile._hasIndex():
  *             raise ValueError( "no index available for iteration" )             # <<<<<<<<<<<<<<
@@ -16199,11 +15215,11 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(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 = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
+    goto __pyx_L7;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
-  /* "pysam/csamtools.pyx":1491
+  /* "csamtools.pyx":1491
  *         # makes sure that samfile stays alive as long as the
  *         # iterator is alive
  *         self.samfile = samfile             # <<<<<<<<<<<<<<
@@ -16212,11 +15228,11 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
  */
   __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;
 
-  /* "pysam/csamtools.pyx":1493
+  /* "csamtools.pyx":1493
  *         self.samfile = samfile
  * 
  *         if samfile.isbam: mode = b"rb"             # <<<<<<<<<<<<<<
@@ -16226,11 +15242,11 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
   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*/ {
 
-    /* "pysam/csamtools.pyx":1494
+    /* "csamtools.pyx":1494
  * 
  *         if samfile.isbam: mode = b"rb"
  *         else: mode = b"r"             # <<<<<<<<<<<<<<
@@ -16240,9 +15256,9 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
     __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
     __pyx_v_mode = __pyx_n_b__r;
   }
-  __pyx_L5:;
+  __pyx_L8:;
 
-  /* "pysam/csamtools.pyx":1498
+  /* "csamtools.pyx":1498
  *         # reopen the file - note that this makes the iterator
  *         # slow and causes pileup to slow down significantly.
  *         if reopen:             # <<<<<<<<<<<<<<
@@ -16251,7 +15267,7 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
  */
   if (__pyx_v_reopen) {
 
-    /* "pysam/csamtools.pyx":1499
+    /* "csamtools.pyx":1499
  *         # slow and causes pileup to slow down significantly.
  *         if reopen:
  *             store = StderrStore()             # <<<<<<<<<<<<<<
@@ -16266,7 +15282,7 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
     __pyx_v_store = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":1500
+    /* "csamtools.pyx":1500
  *         if reopen:
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
@@ -16274,9 +15290,9 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
  *             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);
 
-    /* "pysam/csamtools.pyx":1501
+    /* "csamtools.pyx":1501
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()             # <<<<<<<<<<<<<<
@@ -16290,7 +15306,7 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":1502
+    /* "csamtools.pyx":1502
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  *             assert self.fp != NULL             # <<<<<<<<<<<<<<
@@ -16298,78 +15314,77 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
  *         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;}
     }
     #endif
 
-    /* "pysam/csamtools.pyx":1503
+    /* "csamtools.pyx":1503
  *             store.release()
  *             assert self.fp != NULL
  *             self.owns_samfile = True             # <<<<<<<<<<<<<<
  *         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*/ {
 
-    /* "pysam/csamtools.pyx":1505
+    /* "csamtools.pyx":1505
  *             self.owns_samfile = True
  *         else:
  *             self.fp = self.samfile.samfile             # <<<<<<<<<<<<<<
  *             self.owns_samfile = False
  * 
  */
-    __pyx_t_6 = __pyx_v_self->samfile->samfile;
-    __pyx_v_self->fp = __pyx_t_6;
+    ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->samfile;
 
-    /* "pysam/csamtools.pyx":1506
+    /* "csamtools.pyx":1506
  *         else:
  *             self.fp = self.samfile.samfile
  *             self.owns_samfile = False             # <<<<<<<<<<<<<<
  * 
  *         self.retval = 0
  */
-    __pyx_v_self->owns_samfile = 0;
+    ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile = 0;
   }
-  __pyx_L6:;
+  __pyx_L9:;
 
-  /* "pysam/csamtools.pyx":1508
+  /* "csamtools.pyx":1508
  *             self.owns_samfile = False
  * 
  *         self.retval = 0             # <<<<<<<<<<<<<<
  * 
  *         self.iter = bam_iter_query(self.samfile.index,
  */
-  __pyx_v_self->retval = 0;
+  ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval = 0;
 
-  /* "pysam/csamtools.pyx":1510
+  /* "csamtools.pyx":1510
  *         self.retval = 0
  * 
  *         self.iter = bam_iter_query(self.samfile.index,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":1514
+  /* "csamtools.pyx":1514
  *                                    beg,
  *                                    end)
  *         self.b = bam_init1()             # <<<<<<<<<<<<<<
  * 
  *     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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_mode);
@@ -16379,18 +15394,7 @@ static int __pyx_pf_5pysam_9csamtools_17IteratorRowRegion___cinit__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_17IteratorRowRegion_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_17IteratorRowRegion_3__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_17IteratorRowRegion_2__iter__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1516
+/* "csamtools.pyx":1516
  *         self.b = bam_init1()
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -16398,14 +15402,15 @@ static PyObject *__pyx_pw_5pysam_9csamtools_17IteratorRowRegion_3__iter__(PyObje
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_2__iter__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1517
+  /* "csamtools.pyx":1517
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -16413,8 +15418,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_2__iter__(struct
  *     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);
@@ -16425,7 +15430,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_2__iter__(struct
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1519
+/* "csamtools.pyx":1519
  *         return self
  * 
  *     cdef bam1_t * getCurrent( self ):             # <<<<<<<<<<<<<<
@@ -16433,14 +15438,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_2__iter__(struct
  * 
  */
 
-static bam1_t *__pyx_f_5pysam_9csamtools_17IteratorRowRegion_getCurrent(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *__pyx_v_self) {
+static bam1_t *__pyx_f_9csamtools_17IteratorRowRegion_getCurrent(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
   bam1_t *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getCurrent", 0);
+  __Pyx_RefNannySetupContext("getCurrent");
   __Pyx_TraceCall("getCurrent", __pyx_f[0], 1519);
 
-  /* "pysam/csamtools.pyx":1520
+  /* "csamtools.pyx":1520
  * 
  *     cdef bam1_t * getCurrent( self ):
  *         return self.b             # <<<<<<<<<<<<<<
@@ -16457,7 +15462,7 @@ static bam1_t *__pyx_f_5pysam_9csamtools_17IteratorRowRegion_getCurrent(struct _
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1522
+/* "csamtools.pyx":1522
  *         return self.b
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -16465,14 +15470,14 @@ static bam1_t *__pyx_f_5pysam_9csamtools_17IteratorRowRegion_getCurrent(struct _
  *         self.retval = bam_iter_read( self.fp.x.bam,
  */
 
-static int __pyx_f_5pysam_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *__pyx_v_self) {
+static int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1522);
 
-  /* "pysam/csamtools.pyx":1524
+  /* "csamtools.pyx":1524
  *     cdef int cnext(self):
  *         '''cversion of iterator. Used by IteratorColumn'''
  *         self.retval = bam_iter_read( self.fp.x.bam,             # <<<<<<<<<<<<<<
@@ -16487,22 +15492,7 @@ static int __pyx_f_5pysam_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_17IteratorRowRegion_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_17IteratorRowRegion_4__next__[] = "python version of next().\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
-struct wrapperbase __pyx_wrapperbase_5pysam_9csamtools_17IteratorRowRegion_4__next__;
-#endif
-static PyObject *__pyx_pw_5pysam_9csamtools_17IteratorRowRegion_5__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_17IteratorRowRegion_4__next__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1528
+/* "csamtools.pyx":1528
  *                                      self.b)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -16510,7 +15500,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_17IteratorRowRegion_5__next__(PyObje
  *         """
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_obj_5pysam_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;
@@ -16519,34 +15512,34 @@ static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_4__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], 1528);
 
-  /* "pysam/csamtools.pyx":1531
+  /* "csamtools.pyx":1531
  *         """python version of next().
  *         """
  *         self.cnext()             # <<<<<<<<<<<<<<
  *         if self.retval < 0: raise StopIteration
  *         return makeAlignedRead( self.b )
  */
-  ((struct __pyx_vtabstruct_5pysam_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));
 
-  /* "pysam/csamtools.pyx":1532
+  /* "csamtools.pyx":1532
  *         """
  *         self.cnext()
  *         if self.retval < 0: raise StopIteration             # <<<<<<<<<<<<<<
  *         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:;
 
-  /* "pysam/csamtools.pyx":1533
+  /* "csamtools.pyx":1533
  *         self.cnext()
  *         if self.retval < 0: raise StopIteration
  *         return makeAlignedRead( self.b )             # <<<<<<<<<<<<<<
@@ -16554,7 +15547,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_4__next__(struct
  *     def __dealloc__(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __pyx_f_5pysam_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;
@@ -16564,7 +15557,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_4__next__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowRegion.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowRegion.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -16573,16 +15566,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_17IteratorRowRegion_4__next__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_7__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_5pysam_9csamtools_17IteratorRowRegion_6__dealloc__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "pysam/csamtools.pyx":1535
+/* "csamtools.pyx":1535
  *         return makeAlignedRead( self.b )
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -16590,71 +15574,91 @@ static void __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_7__dealloc__(PyObject
  *         bam_iter_destroy( self.iter )
  */
 
-static void __pyx_pf_5pysam_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1536
+  /* "csamtools.pyx":1536
  * 
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)             # <<<<<<<<<<<<<<
  *         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);
 
-  /* "pysam/csamtools.pyx":1537
+  /* "csamtools.pyx":1537
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)
  *         bam_iter_destroy( self.iter )             # <<<<<<<<<<<<<<
  *         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);
 
-  /* "pysam/csamtools.pyx":1538
+  /* "csamtools.pyx":1538
  *         bam_destroy1(self.b)
  *         bam_iter_destroy( self.iter )
  *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
  * 
  * 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_5pysam_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile = 0;
+/* "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;
+  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -16663,7 +15667,7 @@ static int __pyx_pw_5pysam_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__py
         }
       }
       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 (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)) {
@@ -16673,18 +15677,10 @@ static int __pyx_pw_5pysam_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__py
         default: goto __pyx_L5_argtuple_error;
       }
     }
-    __pyx_v_samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[0]);
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
     if (values[1]) {
       __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
-
-      /* "pysam/csamtools.pyx":1550
- *     """
- * 
- *     def __cinit__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
- * 
- *         if not samfile._isOpen():
- */
       __pyx_v_reopen = ((int)1);
     }
   }
@@ -16692,39 +15688,13 @@ static int __pyx_pw_5pysam_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__py
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowAll.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(((struct __pyx_obj_5pysam_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_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *__pyx_v_self, struct __pyx_obj_5pysam_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;
-  samfile_t *__pyx_t_6;
-  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);
+  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;}
 
-  /* "pysam/csamtools.pyx":1552
+  /* "csamtools.pyx":1552
  *     def __cinit__(self, Samfile samfile, int reopen = True ):
  * 
  *         if not samfile._isOpen():             # <<<<<<<<<<<<<<
@@ -16741,7 +15711,7 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":1553
+    /* "csamtools.pyx":1553
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -16753,11 +15723,11 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
     __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:;
 
-  /* "pysam/csamtools.pyx":1555
+  /* "csamtools.pyx":1555
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         if samfile.isbam: mode = b"rb"             # <<<<<<<<<<<<<<
@@ -16767,11 +15737,11 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
   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*/ {
 
-    /* "pysam/csamtools.pyx":1556
+    /* "csamtools.pyx":1556
  * 
  *         if samfile.isbam: mode = b"rb"
  *         else: mode = b"r"             # <<<<<<<<<<<<<<
@@ -16781,9 +15751,9 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
     __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
     __pyx_v_mode = __pyx_n_b__r;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
-  /* "pysam/csamtools.pyx":1559
+  /* "csamtools.pyx":1559
  * 
  *         # reopen the file to avoid iterator conflict
  *         if reopen:             # <<<<<<<<<<<<<<
@@ -16792,7 +15762,7 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
  */
   if (__pyx_v_reopen) {
 
-    /* "pysam/csamtools.pyx":1560
+    /* "csamtools.pyx":1560
  *         # reopen the file to avoid iterator conflict
  *         if reopen:
  *             store = StderrStore()             # <<<<<<<<<<<<<<
@@ -16807,7 +15777,7 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
     __pyx_v_store = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":1561
+    /* "csamtools.pyx":1561
  *         if reopen:
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
@@ -16815,9 +15785,9 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
  *             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);
 
-    /* "pysam/csamtools.pyx":1562
+    /* "csamtools.pyx":1562
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()             # <<<<<<<<<<<<<<
@@ -16831,7 +15801,7 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":1563
+    /* "csamtools.pyx":1563
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  *             assert self.fp != NULL             # <<<<<<<<<<<<<<
@@ -16839,60 +15809,59 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
  *         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;}
     }
     #endif
 
-    /* "pysam/csamtools.pyx":1564
+    /* "csamtools.pyx":1564
  *             store.release()
  *             assert self.fp != NULL
  *             self.owns_samfile = True             # <<<<<<<<<<<<<<
  *         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*/ {
 
-    /* "pysam/csamtools.pyx":1566
+    /* "csamtools.pyx":1566
  *             self.owns_samfile = True
  *         else:
  *             self.fp = samfile.samfile             # <<<<<<<<<<<<<<
  *             self.owns_samfile = False
  * 
  */
-    __pyx_t_6 = __pyx_v_samfile->samfile;
-    __pyx_v_self->fp = __pyx_t_6;
+    ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
-    /* "pysam/csamtools.pyx":1567
+    /* "csamtools.pyx":1567
  *         else:
  *             self.fp = samfile.samfile
  *             self.owns_samfile = False             # <<<<<<<<<<<<<<
  * 
  *         # 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:;
 
-  /* "pysam/csamtools.pyx":1570
+  /* "csamtools.pyx":1570
  * 
  *         # allocate memory for alignment
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))             # <<<<<<<<<<<<<<
  * 
  *     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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowAll.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_mode);
@@ -16902,18 +15871,7 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorRowAll___cinit__(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorRowAll_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorRowAll_3__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_14IteratorRowAll_2__iter__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1572
+/* "csamtools.pyx":1572
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -16921,14 +15879,15 @@ static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorRowAll_3__iter__(PyObject
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_2__iter__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1573
+  /* "csamtools.pyx":1573
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -16936,8 +15895,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_2__iter__(struct __
  *     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);
@@ -16948,7 +15907,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_2__iter__(struct __
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1575
+/* "csamtools.pyx":1575
  *         return self
  * 
  *     cdef bam1_t * getCurrent( self ):             # <<<<<<<<<<<<<<
@@ -16956,14 +15915,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_2__iter__(struct __
  * 
  */
 
-static bam1_t *__pyx_f_5pysam_9csamtools_14IteratorRowAll_getCurrent(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *__pyx_v_self) {
+static bam1_t *__pyx_f_9csamtools_14IteratorRowAll_getCurrent(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
   bam1_t *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getCurrent", 0);
+  __Pyx_RefNannySetupContext("getCurrent");
   __Pyx_TraceCall("getCurrent", __pyx_f[0], 1575);
 
-  /* "pysam/csamtools.pyx":1576
+  /* "csamtools.pyx":1576
  * 
  *     cdef bam1_t * getCurrent( self ):
  *         return self.b             # <<<<<<<<<<<<<<
@@ -16980,7 +15939,7 @@ static bam1_t *__pyx_f_5pysam_9csamtools_14IteratorRowAll_getCurrent(struct __py
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1578
+/* "csamtools.pyx":1578
  *         return self.b
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -16988,14 +15947,14 @@ static bam1_t *__pyx_f_5pysam_9csamtools_14IteratorRowAll_getCurrent(struct __py
  *         return samread(self.fp, self.b)
  */
 
-static int __pyx_f_5pysam_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *__pyx_v_self) {
+static int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1578);
 
-  /* "pysam/csamtools.pyx":1580
+  /* "csamtools.pyx":1580
  *     cdef int cnext(self):
  *         '''cversion of iterator. Used by IteratorColumn'''
  *         return samread(self.fp, self.b)             # <<<<<<<<<<<<<<
@@ -17012,22 +15971,7 @@ static int __pyx_f_5pysam_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_5py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorRowAll_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_14IteratorRowAll_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
-struct wrapperbase __pyx_wrapperbase_5pysam_9csamtools_14IteratorRowAll_4__next__;
-#endif
-static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorRowAll_5__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_14IteratorRowAll_4__next__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1582
+/* "csamtools.pyx":1582
  *         return samread(self.fp, self.b)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -17035,7 +15979,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorRowAll_5__next__(PyObject
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj_5pysam_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
@@ -17045,19 +15992,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_4__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], 1582);
 
-  /* "pysam/csamtools.pyx":1588
+  /* "csamtools.pyx":1588
  *         """
  *         cdef int ret
  *         ret = samread(self.fp, self.b)             # <<<<<<<<<<<<<<
  *         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);
 
-  /* "pysam/csamtools.pyx":1589
+  /* "csamtools.pyx":1589
  *         cdef int ret
  *         ret = samread(self.fp, self.b)
  *         if (ret > 0):             # <<<<<<<<<<<<<<
@@ -17067,7 +16014,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_4__next__(struct __
   __pyx_t_1 = (__pyx_v_ret > 0);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":1590
+    /* "csamtools.pyx":1590
  *         ret = samread(self.fp, self.b)
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )             # <<<<<<<<<<<<<<
@@ -17075,16 +16022,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_4__next__(struct __
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_5pysam_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*/ {
 
-    /* "pysam/csamtools.pyx":1592
+    /* "csamtools.pyx":1592
  *             return makeAlignedRead( self.b )
  *         else:
  *             raise StopIteration             # <<<<<<<<<<<<<<
@@ -17094,13 +16041,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_4__next__(struct __
     __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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowAll.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowAll.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -17109,16 +16056,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorRowAll_4__next__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_5pysam_9csamtools_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5pysam_9csamtools_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_5pysam_9csamtools_14IteratorRowAll_6__dealloc__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "pysam/csamtools.pyx":1594
+/* "csamtools.pyx":1594
  *             raise StopIteration
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -17126,113 +16064,100 @@ static void __pyx_pw_5pysam_9csamtools_14IteratorRowAll_7__dealloc__(PyObject *_
  *         if self.owns_samfile: samclose( self.fp )
  */
 
-static void __pyx_pf_5pysam_9csamtools_14IteratorRowAll_6__dealloc__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1595
+  /* "csamtools.pyx":1595
  * 
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)             # <<<<<<<<<<<<<<
  *         if self.owns_samfile: samclose( self.fp )
  * 
  */
-  bam_destroy1(__pyx_v_self->b);
+  bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b);
 
-  /* "pysam/csamtools.pyx":1596
+  /* "csamtools.pyx":1596
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)
  *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
  * 
  * 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_5pysam_9csamtools_18IteratorRowAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile = 0;
+/* "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;
   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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--;
+        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;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     }
-    __pyx_v_samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[0]);
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs___cinit__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *)__pyx_v_self), __pyx_v_samfile);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1602
- *     """
- * 
- *     def __cinit__(self, Samfile samfile):             # <<<<<<<<<<<<<<
- *         assert samfile._isOpen()
- *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
- */
+  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;}
 
-static int __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *__pyx_v_self, struct __pyx_obj_5pysam_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);
-
-  /* "pysam/csamtools.pyx":1603
+  /* "csamtools.pyx":1603
  * 
  *     def __cinit__(self, Samfile samfile):
  *         assert samfile._isOpen()             # <<<<<<<<<<<<<<
@@ -17253,7 +16178,7 @@ static int __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs___cinit__(struct __py
   }
   #endif
 
-  /* "pysam/csamtools.pyx":1604
+  /* "csamtools.pyx":1604
  *     def __cinit__(self, Samfile samfile):
  *         assert samfile._isOpen()
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")             # <<<<<<<<<<<<<<
@@ -17274,11 +16199,11 @@ static int __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs___cinit__(struct __py
     __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:;
 
-  /* "pysam/csamtools.pyx":1605
+  /* "csamtools.pyx":1605
  *         assert samfile._isOpen()
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
  *         self.samfile = samfile             # <<<<<<<<<<<<<<
@@ -17287,25 +16212,25 @@ static int __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs___cinit__(struct __py
  */
   __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;
 
-  /* "pysam/csamtools.pyx":1606
+  /* "csamtools.pyx":1606
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")
  *         self.samfile = samfile
  *         self.tid = -1             # <<<<<<<<<<<<<<
  * 
  *     def nextiter(self):
  */
-  __pyx_v_self->tid = -1;
+  ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = -1;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -17313,19 +16238,7 @@ static int __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs___cinit__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_3nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter[] = "IteratorRowAllRefs.nextiter(self)";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter(((struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1608
+/* "csamtools.pyx":1608
  *         self.tid = -1
  * 
  *     def nextiter(self):             # <<<<<<<<<<<<<<
@@ -17333,7 +16246,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_3nextiter(PyObj
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx_obj_5pysam_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;
@@ -17342,23 +16257,23 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter(struc
   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);
 
-  /* "pysam/csamtools.pyx":1609
+  /* "csamtools.pyx":1609
  * 
  *     def nextiter(self):
  *         self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)             # <<<<<<<<<<<<<<
  * 
  *     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);
@@ -17368,13 +16283,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter(struc
   PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_int_536870912);
   __Pyx_GIVEREF(__pyx_int_536870912);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), NULL); 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_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_5pysam_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);
@@ -17382,7 +16297,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter(struc
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowAllRefs.nextiter", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.nextiter", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -17391,18 +16306,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_5__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_5__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_4__iter__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1611
+/* "csamtools.pyx":1611
  *         self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -17410,14 +16314,15 @@ static PyObject *__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_5__iter__(PyObj
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_4__iter__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1612
+  /* "csamtools.pyx":1612
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -17425,8 +16330,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_4__iter__(struc
  *     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);
@@ -17437,22 +16342,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_4__iter__(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_7__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_18IteratorRowAllRefs_6__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
-struct wrapperbase __pyx_wrapperbase_5pysam_9csamtools_18IteratorRowAllRefs_6__next__;
-#endif
-static PyObject *__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_7__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1614
+/* "csamtools.pyx":1614
  *         return self
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -17460,7 +16350,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_7__next__(PyObj
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx_obj_5pysam_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;
@@ -17472,34 +16365,34 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struc
   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);
 
-  /* "pysam/csamtools.pyx":1620
+  /* "csamtools.pyx":1620
  *         """
  *         # Create an initial iterator
  *         if self.tid==-1:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":1621
+    /* "csamtools.pyx":1621
  *         # Create an initial iterator
  *         if self.tid==-1:
  *             if not self.samfile.nreferences:             # <<<<<<<<<<<<<<
  *                 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;
     __pyx_t_3 = (!__pyx_t_1);
     if (__pyx_t_3) {
 
-      /* "pysam/csamtools.pyx":1622
+      /* "csamtools.pyx":1622
  *         if self.tid==-1:
  *             if not self.samfile.nreferences:
  *                 raise StopIteration             # <<<<<<<<<<<<<<
@@ -17508,37 +16401,37 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struc
  */
       __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:;
 
-    /* "pysam/csamtools.pyx":1623
+    /* "csamtools.pyx":1623
  *             if not self.samfile.nreferences:
  *                 raise StopIteration
  *             self.tid = 0             # <<<<<<<<<<<<<<
  *             self.nextiter()
  * 
  */
-    __pyx_v_self->tid = 0;
+    ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = 0;
 
-    /* "pysam/csamtools.pyx":1624
+    /* "csamtools.pyx":1624
  *                 raise StopIteration
  *             self.tid = 0
  *             self.nextiter()             # <<<<<<<<<<<<<<
  * 
  *         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:;
 
-  /* "pysam/csamtools.pyx":1626
+  /* "csamtools.pyx":1626
  *             self.nextiter()
  * 
  *         while 1:             # <<<<<<<<<<<<<<
@@ -17548,26 +16441,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struc
   while (1) {
     if (!1) break;
 
-    /* "pysam/csamtools.pyx":1627
+    /* "csamtools.pyx":1627
  * 
  *         while 1:
  *             self.rowiter.cnext()             # <<<<<<<<<<<<<<
  * 
  *             # If current iterator is not exhausted, return aligned read
  */
-    ((struct __pyx_vtabstruct_5pysam_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);
 
-    /* "pysam/csamtools.pyx":1630
+    /* "csamtools.pyx":1630
  * 
  *             # If current iterator is not exhausted, return aligned read
  *             if self.rowiter.retval>0:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":1631
+      /* "csamtools.pyx":1631
  *             # If current iterator is not exhausted, return aligned read
  *             if self.rowiter.retval>0:
  *                 return makeAlignedRead(self.rowiter.b)             # <<<<<<<<<<<<<<
@@ -17575,60 +16468,61 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struc
  *             self.tid += 1
  */
       __Pyx_XDECREF(__pyx_r);
-      __pyx_t_4 = __pyx_f_5pysam_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:;
 
-    /* "pysam/csamtools.pyx":1633
+    /* "csamtools.pyx":1633
  *                 return makeAlignedRead(self.rowiter.b)
  * 
  *             self.tid += 1             # <<<<<<<<<<<<<<
  * 
  *             # 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);
 
-    /* "pysam/csamtools.pyx":1636
+    /* "csamtools.pyx":1636
  * 
  *             # Otherwise, proceed to next reference or stop
  *             if self.tid<self.samfile.nreferences:             # <<<<<<<<<<<<<<
  *                 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); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_3) {
 
-      /* "pysam/csamtools.pyx":1637
+      /* "csamtools.pyx":1637
  *             # Otherwise, proceed to next reference or stop
  *             if self.tid<self.samfile.nreferences:
  *                 self.nextiter()             # <<<<<<<<<<<<<<
  *             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*/ {
 
-      /* "pysam/csamtools.pyx":1639
+      /* "csamtools.pyx":1639
  *                 self.nextiter()
  *             else:
  *                 raise StopIteration             # <<<<<<<<<<<<<<
@@ -17638,7 +16532,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struc
       __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);
@@ -17647,7 +16541,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struc
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowAllRefs.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -17656,22 +16550,40 @@ static PyObject *__pyx_pf_5pysam_9csamtools_18IteratorRowAllRefs_6__next__(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile = 0;
+/* "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;
+  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__positions,&__pyx_n_s__reopen,0};
     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);
@@ -17679,12 +16591,14 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_1__cinit__(PyObject
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__positions)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__positions);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -17695,7 +16609,7 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_1__cinit__(PyObject
         }
       }
       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 (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)) {
@@ -17706,19 +16620,11 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_1__cinit__(PyObject
         default: goto __pyx_L5_argtuple_error;
       }
     }
-    __pyx_v_samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[0]);
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
     __pyx_v_positions = values[1];
     if (values[2]) {
       __pyx_v_reopen = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
-
-      /* "pysam/csamtools.pyx":1647
- *     """
- * 
- *     def __cinit__(self, Samfile samfile, positions, int reopen = True ):             # <<<<<<<<<<<<<<
- * 
- *         if not samfile._isOpen():
- */
       __pyx_v_reopen = ((int)1);
     }
   }
@@ -17726,39 +16632,13 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_1__cinit__(PyObject
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowSelection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(((struct __pyx_obj_5pysam_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_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *__pyx_v_self, struct __pyx_obj_5pysam_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;
-  samfile_t *__pyx_t_6;
-  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);
+  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;}
 
-  /* "pysam/csamtools.pyx":1649
+  /* "csamtools.pyx":1649
  *     def __cinit__(self, Samfile samfile, positions, int reopen = True ):
  * 
  *         if not samfile._isOpen():             # <<<<<<<<<<<<<<
@@ -17775,7 +16655,7 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
   __pyx_t_4 = (!__pyx_t_3);
   if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":1650
+    /* "csamtools.pyx":1650
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -17787,11 +16667,11 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(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 = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":1652
+  /* "csamtools.pyx":1652
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         if not samfile._isOpen():             # <<<<<<<<<<<<<<
@@ -17808,7 +16688,7 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
   __pyx_t_3 = (!__pyx_t_4);
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":1653
+    /* "csamtools.pyx":1653
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -17820,11 +16700,11 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
     __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:;
 
-  /* "pysam/csamtools.pyx":1655
+  /* "csamtools.pyx":1655
  *             raise ValueError( "I/O operation on closed file" )
  * 
  *         assert samfile.isbam, "can only use this iterator on bam files"             # <<<<<<<<<<<<<<
@@ -17838,7 +16718,7 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
   }
   #endif
 
-  /* "pysam/csamtools.pyx":1656
+  /* "csamtools.pyx":1656
  * 
  *         assert samfile.isbam, "can only use this iterator on bam files"
  *         mode = b"rb"             # <<<<<<<<<<<<<<
@@ -17848,7 +16728,7 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
   __Pyx_INCREF(((PyObject *)__pyx_n_b__rb));
   __pyx_v_mode = __pyx_n_b__rb;
 
-  /* "pysam/csamtools.pyx":1659
+  /* "csamtools.pyx":1659
  * 
  *         # reopen the file to avoid iterator conflict
  *         if reopen:             # <<<<<<<<<<<<<<
@@ -17857,7 +16737,7 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
  */
   if (__pyx_v_reopen) {
 
-    /* "pysam/csamtools.pyx":1660
+    /* "csamtools.pyx":1660
  *         # reopen the file to avoid iterator conflict
  *         if reopen:
  *             store = StderrStore()             # <<<<<<<<<<<<<<
@@ -17872,7 +16752,7 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
     __pyx_v_store = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":1661
+    /* "csamtools.pyx":1661
  *         if reopen:
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
@@ -17880,9 +16760,9 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
  *             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);
 
-    /* "pysam/csamtools.pyx":1662
+    /* "csamtools.pyx":1662
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()             # <<<<<<<<<<<<<<
@@ -17896,7 +16776,7 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":1663
+    /* "csamtools.pyx":1663
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  *             assert self.fp != NULL             # <<<<<<<<<<<<<<
@@ -17904,55 +16784,54 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
  *         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;}
     }
     #endif
 
-    /* "pysam/csamtools.pyx":1664
+    /* "csamtools.pyx":1664
  *             store.release()
  *             assert self.fp != NULL
  *             self.owns_samfile = True             # <<<<<<<<<<<<<<
  *         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*/ {
 
-    /* "pysam/csamtools.pyx":1666
+    /* "csamtools.pyx":1666
  *             self.owns_samfile = True
  *         else:
  *             self.fp = samfile.samfile             # <<<<<<<<<<<<<<
  *             self.owns_samfile = False
  * 
  */
-    __pyx_t_6 = __pyx_v_samfile->samfile;
-    __pyx_v_self->fp = __pyx_t_6;
+    ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
-    /* "pysam/csamtools.pyx":1667
+    /* "csamtools.pyx":1667
  *         else:
  *             self.fp = samfile.samfile
  *             self.owns_samfile = False             # <<<<<<<<<<<<<<
  * 
  *         # 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:;
 
-  /* "pysam/csamtools.pyx":1670
+  /* "csamtools.pyx":1670
  * 
  *         # allocate memory for alignment
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))             # <<<<<<<<<<<<<<
  * 
  *         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))));
 
-  /* "pysam/csamtools.pyx":1672
+  /* "csamtools.pyx":1672
  *         self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
  * 
  *         self.positions = positions             # <<<<<<<<<<<<<<
@@ -17961,25 +16840,25 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
  */
   __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;
 
-  /* "pysam/csamtools.pyx":1673
+  /* "csamtools.pyx":1673
  * 
  *         self.positions = positions
  *         self.current_pos = 0             # <<<<<<<<<<<<<<
  * 
  *     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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowSelection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_mode);
@@ -17989,18 +16868,7 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorRowSelection___cinit__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_20IteratorRowSelection_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_20IteratorRowSelection_3__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_20IteratorRowSelection_2__iter__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1675
+/* "csamtools.pyx":1675
  *         self.current_pos = 0
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -18008,14 +16876,15 @@ static PyObject *__pyx_pw_5pysam_9csamtools_20IteratorRowSelection_3__iter__(PyO
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_2__iter__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1676
+  /* "csamtools.pyx":1676
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -18023,8 +16892,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_2__iter__(str
  *     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);
@@ -18035,7 +16904,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_2__iter__(str
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1678
+/* "csamtools.pyx":1678
  *         return self
  * 
  *     cdef bam1_t * getCurrent( self ):             # <<<<<<<<<<<<<<
@@ -18043,14 +16912,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_2__iter__(str
  * 
  */
 
-static bam1_t *__pyx_f_5pysam_9csamtools_20IteratorRowSelection_getCurrent(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *__pyx_v_self) {
+static bam1_t *__pyx_f_9csamtools_20IteratorRowSelection_getCurrent(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
   bam1_t *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getCurrent", 0);
+  __Pyx_RefNannySetupContext("getCurrent");
   __Pyx_TraceCall("getCurrent", __pyx_f[0], 1678);
 
-  /* "pysam/csamtools.pyx":1679
+  /* "csamtools.pyx":1679
  * 
  *     cdef bam1_t * getCurrent( self ):
  *         return self.b             # <<<<<<<<<<<<<<
@@ -18067,7 +16936,7 @@ static bam1_t *__pyx_f_5pysam_9csamtools_20IteratorRowSelection_getCurrent(struc
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1681
+/* "csamtools.pyx":1681
  *         return self.b
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -18075,7 +16944,7 @@ static bam1_t *__pyx_f_5pysam_9csamtools_20IteratorRowSelection_getCurrent(struc
  * 
  */
 
-static int __pyx_f_5pysam_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *__pyx_v_self) {
+static int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -18086,10 +16955,10 @@ static int __pyx_f_5pysam_9csamtools_20IteratorRowSelection_cnext(struct __pyx_o
   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);
 
-  /* "pysam/csamtools.pyx":1685
+  /* "csamtools.pyx":1685
  * 
  *         # end iteration if out of positions
  *         if self.current_pos >= len(self.positions): return -1             # <<<<<<<<<<<<<<
@@ -18108,7 +16977,7 @@ static int __pyx_f_5pysam_9csamtools_20IteratorRowSelection_cnext(struct __pyx_o
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":1687
+  /* "csamtools.pyx":1687
  *         if self.current_pos >= len(self.positions): return -1
  * 
  *         bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )             # <<<<<<<<<<<<<<
@@ -18121,7 +16990,7 @@ static int __pyx_f_5pysam_9csamtools_20IteratorRowSelection_cnext(struct __pyx_o
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   bam_seek(__pyx_v_self->fp->x.bam, __pyx_t_4, 0);
 
-  /* "pysam/csamtools.pyx":1688
+  /* "csamtools.pyx":1688
  * 
  *         bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
  *         self.current_pos += 1             # <<<<<<<<<<<<<<
@@ -18130,7 +16999,7 @@ static int __pyx_f_5pysam_9csamtools_20IteratorRowSelection_cnext(struct __pyx_o
  */
   __pyx_v_self->current_pos = (__pyx_v_self->current_pos + 1);
 
-  /* "pysam/csamtools.pyx":1689
+  /* "csamtools.pyx":1689
  *         bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
  *         self.current_pos += 1
  *         return samread(self.fp, self.b)             # <<<<<<<<<<<<<<
@@ -18144,7 +17013,7 @@ static int __pyx_f_5pysam_9csamtools_20IteratorRowSelection_cnext(struct __pyx_o
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_WriteUnraisable("pysam.csamtools.IteratorRowSelection.cnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_WriteUnraisable("csamtools.IteratorRowSelection.cnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -18152,22 +17021,7 @@ static int __pyx_f_5pysam_9csamtools_20IteratorRowSelection_cnext(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_20IteratorRowSelection_5__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_20IteratorRowSelection_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
-struct wrapperbase __pyx_wrapperbase_5pysam_9csamtools_20IteratorRowSelection_4__next__;
-#endif
-static PyObject *__pyx_pw_5pysam_9csamtools_20IteratorRowSelection_5__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_20IteratorRowSelection_4__next__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1691
+/* "csamtools.pyx":1691
  *         return samread(self.fp, self.b)
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -18175,7 +17029,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_20IteratorRowSelection_5__next__(PyO
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_4__next__(struct __pyx_obj_5pysam_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
@@ -18185,19 +17042,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_4__next__(str
   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);
 
-  /* "pysam/csamtools.pyx":1697
+  /* "csamtools.pyx":1697
  *         """
  * 
  *         cdef int ret = self.cnext()             # <<<<<<<<<<<<<<
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )
  */
-  __pyx_v_ret = ((struct __pyx_vtabstruct_5pysam_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));
 
-  /* "pysam/csamtools.pyx":1698
+  /* "csamtools.pyx":1698
  * 
  *         cdef int ret = self.cnext()
  *         if (ret > 0):             # <<<<<<<<<<<<<<
@@ -18207,7 +17064,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_4__next__(str
   __pyx_t_1 = (__pyx_v_ret > 0);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":1699
+    /* "csamtools.pyx":1699
  *         cdef int ret = self.cnext()
  *         if (ret > 0):
  *             return makeAlignedRead( self.b )             # <<<<<<<<<<<<<<
@@ -18215,16 +17072,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_4__next__(str
  *             raise StopIteration
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = __pyx_f_5pysam_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*/ {
 
-    /* "pysam/csamtools.pyx":1701
+    /* "csamtools.pyx":1701
  *             return makeAlignedRead( self.b )
  *         else:
  *             raise StopIteration             # <<<<<<<<<<<<<<
@@ -18234,13 +17091,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_4__next__(str
     __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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorRowSelection.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorRowSelection.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -18249,16 +17106,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorRowSelection_4__next__(str
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_7__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_5pysam_9csamtools_20IteratorRowSelection_6__dealloc__(((struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "pysam/csamtools.pyx":1703
+/* "csamtools.pyx":1703
  *             raise StopIteration
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -18266,39 +17114,40 @@ static void __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_7__dealloc__(PyObj
  *         if self.owns_samfile: samclose( self.fp )
  */
 
-static void __pyx_pf_5pysam_9csamtools_20IteratorRowSelection_6__dealloc__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1704
+  /* "csamtools.pyx":1704
  * 
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)             # <<<<<<<<<<<<<<
  *         if self.owns_samfile: samclose( self.fp )
  * 
  */
-  bam_destroy1(__pyx_v_self->b);
+  bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b);
 
-  /* "pysam/csamtools.pyx":1705
+  /* "csamtools.pyx":1705
  *     def __dealloc__(self):
  *         bam_destroy1(self.b)
  *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
  * 
  * ##-------------------------------------------------------------------
  */
-  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();
 }
 
-/* "pysam/csamtools.pyx":1710
+/* "csamtools.pyx":1710
  * ##-------------------------------------------------------------------
  * ##-------------------------------------------------------------------
  * cdef int __advance_all( void * data, bam1_t * b ):             # <<<<<<<<<<<<<<
@@ -18306,24 +17155,24 @@ static void __pyx_pf_5pysam_9csamtools_20IteratorRowSelection_6__dealloc__(struc
  *     '''
  */
 
-static int __pyx_f_5pysam_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v_b) {
-  __pyx_t_5pysam_9csamtools___iterdata *__pyx_v_d;
+static int __pyx_f_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v_b) {
+  __pyx_t_9csamtools___iterdata *__pyx_v_d;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("__advance_all", 0);
+  __Pyx_RefNannySetupContext("__advance_all");
   __Pyx_TraceCall("__advance_all", __pyx_f[0], 1710);
 
-  /* "pysam/csamtools.pyx":1714
+  /* "csamtools.pyx":1714
  *     '''
  *     cdef __iterdata * d
  *     d = <__iterdata*>data             # <<<<<<<<<<<<<<
  *     return bam_iter_read( d.samfile.x.bam, d.iter, b )
  * 
  */
-  __pyx_v_d = ((__pyx_t_5pysam_9csamtools___iterdata *)__pyx_v_data);
+  __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data);
 
-  /* "pysam/csamtools.pyx":1715
+  /* "csamtools.pyx":1715
  *     cdef __iterdata * d
  *     d = <__iterdata*>data
  *     return bam_iter_read( d.samfile.x.bam, d.iter, b )             # <<<<<<<<<<<<<<
@@ -18340,7 +17189,7 @@ static int __pyx_f_5pysam_9csamtools___advance_all(void *__pyx_v_data, bam1_t *_
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1717
+/* "csamtools.pyx":1717
  *     return bam_iter_read( d.samfile.x.bam, d.iter, b )
  * 
  * cdef int __advance_snpcalls( void * data, bam1_t * b ):             # <<<<<<<<<<<<<<
@@ -18348,8 +17197,8 @@ static int __pyx_f_5pysam_9csamtools___advance_all(void *__pyx_v_data, bam1_t *_
  *     the samtools pileup.
  */
 
-static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__pyx_v_b) {
-  __pyx_t_5pysam_9csamtools___iterdata *__pyx_v_d;
+static int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__pyx_v_b) {
+  __pyx_t_9csamtools___iterdata *__pyx_v_d;
   int __pyx_v_ret;
   int __pyx_v_skip;
   int __pyx_v_q;
@@ -18361,28 +17210,27 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
   int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
-  int32_t __pyx_t_4;
+  PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  long __pyx_t_8;
+  long __pyx_t_7;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":1722
+  /* "csamtools.pyx":1722
  *     '''
  *     cdef __iterdata * d
  *     d = <__iterdata*>data             # <<<<<<<<<<<<<<
  * 
  *     cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
  */
-  __pyx_v_d = ((__pyx_t_5pysam_9csamtools___iterdata *)__pyx_v_data);
+  __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data);
 
-  /* "pysam/csamtools.pyx":1724
+  /* "csamtools.pyx":1724
  *     d = <__iterdata*>data
  * 
  *     cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )             # <<<<<<<<<<<<<<
@@ -18391,7 +17239,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
  */
   __pyx_v_ret = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b);
 
-  /* "pysam/csamtools.pyx":1725
+  /* "csamtools.pyx":1725
  * 
  *     cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
  *     cdef int skip = 0             # <<<<<<<<<<<<<<
@@ -18400,7 +17248,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
  */
   __pyx_v_skip = 0;
 
-  /* "pysam/csamtools.pyx":1727
+  /* "csamtools.pyx":1727
  *     cdef int skip = 0
  *     cdef int q
  *     cdef int is_cns = 1             # <<<<<<<<<<<<<<
@@ -18409,7 +17257,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
  */
   __pyx_v_is_cns = 1;
 
-  /* "pysam/csamtools.pyx":1728
+  /* "csamtools.pyx":1728
  *     cdef int q
  *     cdef int is_cns = 1
  *     cdef int is_nobaq = 0             # <<<<<<<<<<<<<<
@@ -18418,7 +17266,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
  */
   __pyx_v_is_nobaq = 0;
 
-  /* "pysam/csamtools.pyx":1729
+  /* "csamtools.pyx":1729
  *     cdef int is_cns = 1
  *     cdef int is_nobaq = 0
  *     cdef int capQ_thres = 0             # <<<<<<<<<<<<<<
@@ -18427,7 +17275,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
  */
   __pyx_v_capQ_thres = 0;
 
-  /* "pysam/csamtools.pyx":1732
+  /* "csamtools.pyx":1732
  * 
  *     # reload sequence
  *     if d.fastafile != NULL and b.core.tid != d.tid:             # <<<<<<<<<<<<<<
@@ -18443,7 +17291,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
   }
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":1733
+    /* "csamtools.pyx":1733
  *     # reload sequence
  *     if d.fastafile != NULL and b.core.tid != d.tid:
  *         if d.seq != NULL: free(d.seq)             # <<<<<<<<<<<<<<
@@ -18457,26 +17305,25 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
     }
     __pyx_L4:;
 
-    /* "pysam/csamtools.pyx":1734
+    /* "csamtools.pyx":1734
  *     if d.fastafile != NULL and b.core.tid != d.tid:
  *         if d.seq != NULL: free(d.seq)
  *         d.tid = b.core.tid             # <<<<<<<<<<<<<<
  *         d.seq = faidx_fetch_seq(d.fastafile,
  *                                 d.samfile.header.target_name[d.tid],
  */
-    __pyx_t_4 = __pyx_v_b->core.tid;
-    __pyx_v_d->tid = __pyx_t_4;
+    __pyx_v_d->tid = __pyx_v_b->core.tid;
 
-    /* "pysam/csamtools.pyx":1735
+    /* "csamtools.pyx":1735
  *         if d.seq != NULL: free(d.seq)
  *         d.tid = b.core.tid
  *         d.seq = faidx_fetch_seq(d.fastafile,             # <<<<<<<<<<<<<<
  *                                 d.samfile.header.target_name[d.tid],
  *                                 0, max_pos,
  */
-    __pyx_v_d->seq = faidx_fetch_seq(__pyx_v_d->fastafile, (__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid]), 0, __pyx_v_5pysam_9csamtools_max_pos, (&__pyx_v_d->seq_len));
+    __pyx_v_d->seq = faidx_fetch_seq(__pyx_v_d->fastafile, (__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid]), 0, __pyx_v_9csamtools_max_pos, (&__pyx_v_d->seq_len));
 
-    /* "pysam/csamtools.pyx":1739
+    /* "csamtools.pyx":1739
  *                                 0, max_pos,
  *                                 &d.seq_len)
  *         if d.seq == NULL:             # <<<<<<<<<<<<<<
@@ -18486,46 +17333,46 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
     __pyx_t_3 = (__pyx_v_d->seq == NULL);
     if (__pyx_t_3) {
 
-      /* "pysam/csamtools.pyx":1741
+      /* "csamtools.pyx":1741
  *         if d.seq == NULL:
  *             raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
  *                                   (d.samfile.header.target_name[d.tid],             # <<<<<<<<<<<<<<
  *                                    d.tid))
  * 
  */
-      __pyx_t_5 = PyBytes_FromString((__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+      __pyx_t_4 = PyBytes_FromString((__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
-      /* "pysam/csamtools.pyx":1742
+      /* "csamtools.pyx":1742
  *             raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
  *                                   (d.samfile.header.target_name[d.tid],
  *                                    d.tid))             # <<<<<<<<<<<<<<
  * 
  * 
  */
-      __pyx_t_6 = PyInt_FromLong(__pyx_v_d->tid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __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 = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_5));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
-      __Pyx_GIVEREF(__pyx_t_6);
+      __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(((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);
+      __Pyx_GIVEREF(__pyx_t_5);
+      __pyx_t_4 = 0;
       __pyx_t_5 = 0;
-      __pyx_t_6 = 0;
-      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_126), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_126), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __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(((PyObject *)__pyx_t_6));
-      __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 = 1740; __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));
-      __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+      __pyx_t_5 = 0;
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
@@ -18534,7 +17381,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":1745
+  /* "csamtools.pyx":1745
  * 
  * 
  *     while ret >= 0:             # <<<<<<<<<<<<<<
@@ -18545,7 +17392,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
     __pyx_t_3 = (__pyx_v_ret >= 0);
     if (!__pyx_t_3) break;
 
-    /* "pysam/csamtools.pyx":1747
+    /* "csamtools.pyx":1747
  *     while ret >= 0:
  * 
  *         skip = 0             # <<<<<<<<<<<<<<
@@ -18554,7 +17401,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
  */
     __pyx_v_skip = 0;
 
-    /* "pysam/csamtools.pyx":1750
+    /* "csamtools.pyx":1750
  * 
  *         # realign read - changes base qualities
  *         if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq )             # <<<<<<<<<<<<<<
@@ -18579,7 +17426,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
     }
     __pyx_L8:;
 
-    /* "pysam/csamtools.pyx":1752
+    /* "csamtools.pyx":1752
  *         if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq )
  * 
  *         if d.seq != NULL and capQ_thres > 10:             # <<<<<<<<<<<<<<
@@ -18595,7 +17442,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
     }
     if (__pyx_t_2) {
 
-      /* "pysam/csamtools.pyx":1753
+      /* "csamtools.pyx":1753
  * 
  *         if d.seq != NULL and capQ_thres > 10:
  *             q = bam_cap_mapQ(b, d.seq, capQ_thres)             # <<<<<<<<<<<<<<
@@ -18604,7 +17451,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
  */
       __pyx_v_q = bam_cap_mapQ(__pyx_v_b, __pyx_v_d->seq, __pyx_v_capQ_thres);
 
-      /* "pysam/csamtools.pyx":1754
+      /* "csamtools.pyx":1754
  *         if d.seq != NULL and capQ_thres > 10:
  *             q = bam_cap_mapQ(b, d.seq, capQ_thres)
  *             if q < 0: skip = 1             # <<<<<<<<<<<<<<
@@ -18617,7 +17464,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
         goto __pyx_L10;
       }
 
-      /* "pysam/csamtools.pyx":1755
+      /* "csamtools.pyx":1755
  *             q = bam_cap_mapQ(b, d.seq, capQ_thres)
  *             if q < 0: skip = 1
  *             elif b.core.qual > q: b.core.qual = q             # <<<<<<<<<<<<<<
@@ -18634,20 +17481,20 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
     }
     __pyx_L9:;
 
-    /* "pysam/csamtools.pyx":1756
+    /* "csamtools.pyx":1756
  *             if q < 0: skip = 1
  *             elif b.core.qual > q: b.core.qual = q
  *         if b.core.flag & BAM_FUNMAP: skip = 1             # <<<<<<<<<<<<<<
  *         elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
  * 
  */
-    __pyx_t_8 = (__pyx_v_b->core.flag & 4);
-    if (__pyx_t_8) {
+    __pyx_t_7 = (__pyx_v_b->core.flag & 4);
+    if (__pyx_t_7) {
       __pyx_v_skip = 1;
       goto __pyx_L11;
     }
 
-    /* "pysam/csamtools.pyx":1757
+    /* "csamtools.pyx":1757
  *             elif b.core.qual > q: b.core.qual = q
  *         if b.core.flag & BAM_FUNMAP: skip = 1
  *         elif b.core.flag & 1 and not b.core.flag & 2: skip = 1             # <<<<<<<<<<<<<<
@@ -18666,7 +17513,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
     }
     __pyx_L11:;
 
-    /* "pysam/csamtools.pyx":1759
+    /* "csamtools.pyx":1759
  *         elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
  * 
  *         if not skip: break             # <<<<<<<<<<<<<<
@@ -18680,7 +17527,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
     }
     __pyx_L12:;
 
-    /* "pysam/csamtools.pyx":1762
+    /* "csamtools.pyx":1762
  *         # additional filters
  * 
  *         ret = bam_iter_read( d.samfile.x.bam, d.iter, b )             # <<<<<<<<<<<<<<
@@ -18691,7 +17538,7 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
   }
   __pyx_L7_break:;
 
-  /* "pysam/csamtools.pyx":1764
+  /* "csamtools.pyx":1764
  *         ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
  * 
  *     return ret             # <<<<<<<<<<<<<<
@@ -18704,10 +17551,10 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_WriteUnraisable("pysam.csamtools.__advance_snpcalls", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_WriteUnraisable("csamtools.__advance_snpcalls", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -18715,85 +17562,70 @@ static int __pyx_f_5pysam_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_14IteratorColumn_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_9csamtools_14IteratorColumn_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile = 0;
+/* "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;
   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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--;
+        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;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     }
-    __pyx_v_samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[0]);
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumn.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_14IteratorColumn___cinit__(((struct __pyx_obj_5pysam_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;
-}
-
-/* "pysam/csamtools.pyx":1813
- *     '''
- * 
- *     def __cinit__( self, Samfile samfile, **kwargs ):             # <<<<<<<<<<<<<<
- *         self.samfile = samfile
- *         self.mask = kwargs.get("mask", BAM_DEF_MASK )
- */
-
-static int __pyx_pf_5pysam_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_5pysam_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);
+  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;}
 
-  /* "pysam/csamtools.pyx":1814
+  /* "csamtools.pyx":1814
  * 
  *     def __cinit__( self, Samfile samfile, **kwargs ):
  *         self.samfile = samfile             # <<<<<<<<<<<<<<
@@ -18802,17 +17634,20 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorColumn___cinit__(struct __pyx_ob
  */
   __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;
 
-  /* "pysam/csamtools.pyx":1815
+  /* "csamtools.pyx":1815
  *     def __cinit__( self, Samfile samfile, **kwargs ):
  *         self.samfile = samfile
  *         self.mask = kwargs.get("mask", BAM_DEF_MASK )             # <<<<<<<<<<<<<<
  *         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;}
@@ -18820,131 +17655,130 @@ static int __pyx_pf_5pysam_9csamtools_14IteratorColumn___cinit__(struct __pyx_ob
   __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;
 
-  /* "pysam/csamtools.pyx":1816
+  /* "csamtools.pyx":1816
  *         self.samfile = samfile
  *         self.mask = kwargs.get("mask", BAM_DEF_MASK )
  *         self.fastafile = kwargs.get( "fastafile", None )             # <<<<<<<<<<<<<<
  *         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_5pysam_9csamtools_Fastafile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  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_5pysam_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;
 
-  /* "pysam/csamtools.pyx":1817
+  /* "csamtools.pyx":1817
  *         self.mask = kwargs.get("mask", BAM_DEF_MASK )
  *         self.fastafile = kwargs.get( "fastafile", None )
  *         self.stepper = kwargs.get( "stepper", None )             # <<<<<<<<<<<<<<
  *         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;
 
-  /* "pysam/csamtools.pyx":1818
+  /* "csamtools.pyx":1818
  *         self.fastafile = kwargs.get( "fastafile", None )
  *         self.stepper = kwargs.get( "stepper", None )
  *         self.max_depth = kwargs.get( "max_depth", 8000 )             # <<<<<<<<<<<<<<
  *         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;
 
-  /* "pysam/csamtools.pyx":1819
+  /* "csamtools.pyx":1819
  *         self.stepper = kwargs.get( "stepper", None )
  *         self.max_depth = kwargs.get( "max_depth", 8000 )
  *         self.iterdata.seq = NULL             # <<<<<<<<<<<<<<
  *         self.tid = 0
  *         self.pos = 0
  */
-  __pyx_v_self->iterdata.seq = NULL;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq = NULL;
 
-  /* "pysam/csamtools.pyx":1820
+  /* "csamtools.pyx":1820
  *         self.max_depth = kwargs.get( "max_depth", 8000 )
  *         self.iterdata.seq = NULL
  *         self.tid = 0             # <<<<<<<<<<<<<<
  *         self.pos = 0
  *         self.n_plp = 0
  */
-  __pyx_v_self->tid = 0;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->tid = 0;
 
-  /* "pysam/csamtools.pyx":1821
+  /* "csamtools.pyx":1821
  *         self.iterdata.seq = NULL
  *         self.tid = 0
  *         self.pos = 0             # <<<<<<<<<<<<<<
  *         self.n_plp = 0
  *         self.plp = NULL
  */
-  __pyx_v_self->pos = 0;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pos = 0;
 
-  /* "pysam/csamtools.pyx":1822
+  /* "csamtools.pyx":1822
  *         self.tid = 0
  *         self.pos = 0
  *         self.n_plp = 0             # <<<<<<<<<<<<<<
  *         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;
 
-  /* "pysam/csamtools.pyx":1823
+  /* "csamtools.pyx":1823
  *         self.pos = 0
  *         self.n_plp = 0
  *         self.plp = NULL             # <<<<<<<<<<<<<<
  *         self.pileup_iter = <bam_plp_t>NULL
  * 
  */
-  __pyx_v_self->plp = NULL;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->plp = NULL;
 
-  /* "pysam/csamtools.pyx":1824
+  /* "csamtools.pyx":1824
  *         self.n_plp = 0
  *         self.plp = NULL
  *         self.pileup_iter = <bam_plp_t>NULL             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  __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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumn.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __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_5pysam_9csamtools_14IteratorColumn_3__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorColumn_3__iter__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_14IteratorColumn_2__iter__(((struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1827
+/* "csamtools.pyx":1827
  * 
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
@@ -18952,14 +17786,15 @@ static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorColumn_3__iter__(PyObject
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_2__iter__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1828
+  /* "csamtools.pyx":1828
  * 
  *     def __iter__(self):
  *         return self             # <<<<<<<<<<<<<<
@@ -18967,8 +17802,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_2__iter__(struct __
  *     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);
@@ -18979,7 +17814,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_2__iter__(struct __
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1830
+/* "csamtools.pyx":1830
  *         return self
  * 
  *     cdef int cnext(self):             # <<<<<<<<<<<<<<
@@ -18987,14 +17822,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_2__iter__(struct __
  * 
  */
 
-static int __pyx_f_5pysam_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self) {
+static int __pyx_f_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("cnext", 0);
+  __Pyx_RefNannySetupContext("cnext");
   __Pyx_TraceCall("cnext", __pyx_f[0], 1830);
 
-  /* "pysam/csamtools.pyx":1836
+  /* "csamtools.pyx":1836
  *         It has been re-implemented to permit for filtering.
  *         '''
  *         self.plp = bam_plp_auto( self.pileup_iter,             # <<<<<<<<<<<<<<
@@ -19009,7 +17844,7 @@ static int __pyx_f_5pysam_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_5py
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1841
+/* "csamtools.pyx":1841
  *                                  &self.n_plp )
  * 
  *     cdef char * getSequence( self ):             # <<<<<<<<<<<<<<
@@ -19017,14 +17852,14 @@ static int __pyx_f_5pysam_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_5py
  *         '''
  */
 
-static char *__pyx_f_5pysam_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self) {
+static char *__pyx_f_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("getSequence", 0);
+  __Pyx_RefNannySetupContext("getSequence");
   __Pyx_TraceCall("getSequence", __pyx_f[0], 1841);
 
-  /* "pysam/csamtools.pyx":1844
+  /* "csamtools.pyx":1844
  *         '''return current reference sequence underlying the iterator.
  *         '''
  *         return self.iterdata.seq             # <<<<<<<<<<<<<<
@@ -19041,18 +17876,7 @@ static char *__pyx_f_5pysam_9csamtools_14IteratorColumn_getSequence(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorColumn_7seq_len_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_14IteratorColumn_7seq_len___get__(((struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1848
+/* "csamtools.pyx":1848
  *     property seq_len:
  *         '''current sequence length.'''
  *         def __get__(self): return self.iterdata.seq_len             # <<<<<<<<<<<<<<
@@ -19060,7 +17884,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorColumn_7seq_len_1__get__(P
  *     def addReference( self, Fastafile fastafile ):
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_7seq_len___get__(struct __pyx_obj_5pysam_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;
@@ -19068,10 +17893,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_7seq_len___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], 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;
@@ -19081,7 +17906,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_7seq_len___get__(st
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumn.seq_len.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumn.seq_len.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -19090,24 +17915,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_7seq_len___get__(st
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorColumn_5addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_14IteratorColumn_4addReference[] = "IteratorColumn.addReference(self, Fastafile fastafile)\n\n       add reference sequences in *fastafile* to iterator.";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_Fastafile, 1, "fastafile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_14IteratorColumn_4addReference(((struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_5pysam_9csamtools_Fastafile *)__pyx_v_fastafile));
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1850
+/* "csamtools.pyx":1850
  *         def __get__(self): return self.iterdata.seq_len
  * 
  *     def addReference( self, Fastafile fastafile ):             # <<<<<<<<<<<<<<
@@ -19115,81 +17923,78 @@ static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorColumn_5addReference(PyObj
  *        add reference sequences in *fastafile* to iterator.'''
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_4addReference(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_5pysam_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;
-  faidx_t *__pyx_t_2;
+  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;}
 
-  /* "pysam/csamtools.pyx":1853
+  /* "csamtools.pyx":1853
  *        '''
  *        add reference sequences in *fastafile* to iterator.'''
  *        self.fastafile = fastafile             # <<<<<<<<<<<<<<
  *        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);
 
-  /* "pysam/csamtools.pyx":1854
+  /* "csamtools.pyx":1854
  *        add reference sequences in *fastafile* to iterator.'''
  *        self.fastafile = fastafile
  *        if self.iterdata.seq != NULL: free(self.iterdata.seq)             # <<<<<<<<<<<<<<
  *        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:;
 
-  /* "pysam/csamtools.pyx":1855
+  /* "csamtools.pyx":1855
  *        self.fastafile = fastafile
  *        if self.iterdata.seq != NULL: free(self.iterdata.seq)
  *        self.iterdata.tid = -1             # <<<<<<<<<<<<<<
  *        self.iterdata.fastafile = self.fastafile.fastafile
  * 
  */
-  __pyx_v_self->iterdata.tid = -1;
+  ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.tid = -1;
 
-  /* "pysam/csamtools.pyx":1856
+  /* "csamtools.pyx":1856
  *        if self.iterdata.seq != NULL: free(self.iterdata.seq)
  *        self.iterdata.tid = -1
  *        self.iterdata.fastafile = self.fastafile.fastafile             # <<<<<<<<<<<<<<
  * 
  *     def hasReference( self ):
  */
-  __pyx_t_2 = __pyx_v_self->fastafile->fastafile;
-  __pyx_v_self->iterdata.fastafile = __pyx_t_2;
+  ((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_5pysam_9csamtools_14IteratorColumn_7hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_14IteratorColumn_6hasReference[] = "IteratorColumn.hasReference(self)\n\n        return true if iterator is associated with a reference";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_14IteratorColumn_6hasReference(((struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1858
+/* "csamtools.pyx":1858
  *        self.iterdata.fastafile = self.fastafile.fastafile
  * 
  *     def hasReference( self ):             # <<<<<<<<<<<<<<
@@ -19197,14 +18002,16 @@ static PyObject *__pyx_pw_5pysam_9csamtools_14IteratorColumn_7hasReference(PyObj
  *         return true if iterator is associated with a reference'''
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_6hasReference(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1861
+  /* "csamtools.pyx":1861
  *         '''
  *         return true if iterator is associated with a reference'''
  *         return self.fastafile             # <<<<<<<<<<<<<<
@@ -19212,8 +18019,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_6hasReference(struc
  *     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);
@@ -19224,7 +18031,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_6hasReference(struc
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1863
+/* "csamtools.pyx":1863
  *         return self.fastafile
  * 
  *     cdef setMask( self, mask ):             # <<<<<<<<<<<<<<
@@ -19232,7 +18039,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_14IteratorColumn_6hasReference(struc
  * 
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setMask(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_mask) {
+static PyObject *__pyx_f_9csamtools_14IteratorColumn_setMask(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_mask) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -19240,10 +18047,10 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setMask(struct __pyx
   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);
 
-  /* "pysam/csamtools.pyx":1868
+  /* "csamtools.pyx":1868
  *         reads with bits set in *mask* will be skipped.
  *         '''
  *         self.mask = mask             # <<<<<<<<<<<<<<
@@ -19253,7 +18060,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setMask(struct __pyx
   __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_mask); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_self->mask = __pyx_t_1;
 
-  /* "pysam/csamtools.pyx":1869
+  /* "csamtools.pyx":1869
  *         '''
  *         self.mask = mask
  *         bam_plp_set_mask( self.pileup_iter, self.mask )             # <<<<<<<<<<<<<<
@@ -19265,7 +18072,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setMask(struct __pyx
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumn.setMask", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumn.setMask", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -19274,7 +18081,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setMask(struct __pyx
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1871
+/* "csamtools.pyx":1871
  *         bam_plp_set_mask( self.pileup_iter, self.mask )
  * 
  *     cdef setupIteratorData( self,             # <<<<<<<<<<<<<<
@@ -19282,7 +18089,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setMask(struct __pyx
  *                             int start,
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_opt_args_5pysam_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args) {
+static PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args) {
   int __pyx_v_reopen = ((int)0);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -19291,17 +18098,14 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  samfile_t *__pyx_t_6;
-  bam_iter_t __pyx_t_7;
+  int __pyx_t_6;
+  int __pyx_t_7;
   int __pyx_t_8;
-  faidx_t *__pyx_t_9;
-  int __pyx_t_10;
-  int __pyx_t_11;
   int __pyx_lineno = 0;
   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) {
@@ -19309,7 +18113,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
     }
   }
 
-  /* "pysam/csamtools.pyx":1878
+  /* "csamtools.pyx":1878
  *         '''setup the iterator structure'''
  * 
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )             # <<<<<<<<<<<<<<
@@ -19325,7 +18129,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
   __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));
@@ -19341,36 +18145,34 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5pysam_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_5), NULL); 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_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
   __Pyx_GIVEREF(__pyx_t_4);
   __Pyx_GOTREF(__pyx_v_self->iter);
   __Pyx_DECREF(((PyObject *)__pyx_v_self->iter));
-  __pyx_v_self->iter = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)__pyx_t_4);
+  __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_4);
   __pyx_t_4 = 0;
 
-  /* "pysam/csamtools.pyx":1879
+  /* "csamtools.pyx":1879
  * 
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )
  *         self.iterdata.samfile = self.samfile.samfile             # <<<<<<<<<<<<<<
  *         self.iterdata.iter = self.iter.iter
  *         self.iterdata.seq = NULL
  */
-  __pyx_t_6 = __pyx_v_self->samfile->samfile;
-  __pyx_v_self->iterdata.samfile = __pyx_t_6;
+  __pyx_v_self->iterdata.samfile = __pyx_v_self->samfile->samfile;
 
-  /* "pysam/csamtools.pyx":1880
+  /* "csamtools.pyx":1880
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )
  *         self.iterdata.samfile = self.samfile.samfile
  *         self.iterdata.iter = self.iter.iter             # <<<<<<<<<<<<<<
  *         self.iterdata.seq = NULL
  *         self.iterdata.tid = -1
  */
-  __pyx_t_7 = __pyx_v_self->iter->iter;
-  __pyx_v_self->iterdata.iter = __pyx_t_7;
+  __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter;
 
-  /* "pysam/csamtools.pyx":1881
+  /* "csamtools.pyx":1881
  *         self.iterdata.samfile = self.samfile.samfile
  *         self.iterdata.iter = self.iter.iter
  *         self.iterdata.seq = NULL             # <<<<<<<<<<<<<<
@@ -19379,7 +18181,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
  */
   __pyx_v_self->iterdata.seq = NULL;
 
-  /* "pysam/csamtools.pyx":1882
+  /* "csamtools.pyx":1882
  *         self.iterdata.iter = self.iter.iter
  *         self.iterdata.seq = NULL
  *         self.iterdata.tid = -1             # <<<<<<<<<<<<<<
@@ -19388,32 +18190,32 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
  */
   __pyx_v_self->iterdata.tid = -1;
 
-  /* "pysam/csamtools.pyx":1884
+  /* "csamtools.pyx":1884
  *         self.iterdata.tid = -1
  * 
  *         if self.fastafile != None:             # <<<<<<<<<<<<<<
  *             self.iterdata.fastafile = self.fastafile.fastafile
  *         else:
  */
-  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_self->fastafile), Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_self->fastafile), Py_None, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
-    /* "pysam/csamtools.pyx":1885
+    /* "csamtools.pyx":1885
  * 
  *         if self.fastafile != None:
  *             self.iterdata.fastafile = self.fastafile.fastafile             # <<<<<<<<<<<<<<
  *         else:
  *             self.iterdata.fastafile = NULL
  */
-    __pyx_t_9 = __pyx_v_self->fastafile->fastafile;
-    __pyx_v_self->iterdata.fastafile = __pyx_t_9;
+    __pyx_v_self->iterdata.fastafile = __pyx_v_self->fastafile->fastafile;
     goto __pyx_L3;
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":1887
+    /* "csamtools.pyx":1887
  *             self.iterdata.fastafile = self.fastafile.fastafile
  *         else:
  *             self.iterdata.fastafile = NULL             # <<<<<<<<<<<<<<
@@ -19424,62 +18226,59 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":1889
+  /* "csamtools.pyx":1889
  *             self.iterdata.fastafile = NULL
  * 
  *         if self.stepper == None or self.stepper == "all":             # <<<<<<<<<<<<<<
  *             self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
  *         elif self.stepper == "samtools":
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, Py_None, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (!__pyx_t_8) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__all), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_11 = __pyx_t_10;
+  if (!__pyx_t_6) {
+    __pyx_t_7 = __Pyx_PyString_Equals(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__all), Py_EQ); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __pyx_t_7;
   } else {
-    __pyx_t_11 = __pyx_t_8;
+    __pyx_t_8 = __pyx_t_6;
   }
-  if (__pyx_t_11) {
+  if (__pyx_t_8) {
 
-    /* "pysam/csamtools.pyx":1890
+    /* "csamtools.pyx":1890
  * 
  *         if self.stepper == None or self.stepper == "all":
  *             self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )             # <<<<<<<<<<<<<<
  *         elif self.stepper == "samtools":
  *             self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
  */
-    __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_5pysam_9csamtools___advance_all), (&__pyx_v_self->iterdata));
+    __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_9csamtools___advance_all), (&__pyx_v_self->iterdata));
     goto __pyx_L4;
   }
 
-  /* "pysam/csamtools.pyx":1891
+  /* "csamtools.pyx":1891
  *         if self.stepper == None or self.stepper == "all":
  *             self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
  *         elif self.stepper == "samtools":             # <<<<<<<<<<<<<<
  *             self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
  *         else:
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__samtools), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (__pyx_t_11) {
+  __pyx_t_8 = __Pyx_PyString_Equals(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__samtools), Py_EQ); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_8) {
 
-    /* "pysam/csamtools.pyx":1892
+    /* "csamtools.pyx":1892
  *             self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
  *         elif self.stepper == "samtools":
  *             self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )             # <<<<<<<<<<<<<<
  *         else:
  *             raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)
  */
-    __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_5pysam_9csamtools___advance_snpcalls), (&__pyx_v_self->iterdata));
+    __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_9csamtools___advance_snpcalls), (&__pyx_v_self->iterdata));
     goto __pyx_L4;
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":1894
+    /* "csamtools.pyx":1894
  *             self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
  *         else:
  *             raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)             # <<<<<<<<<<<<<<
@@ -19489,7 +18288,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
     __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;
@@ -19502,7 +18301,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
   }
   __pyx_L4:;
 
-  /* "pysam/csamtools.pyx":1896
+  /* "csamtools.pyx":1896
  *             raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)
  * 
  *         if self.max_depth:             # <<<<<<<<<<<<<<
@@ -19511,7 +18310,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
  */
   if (__pyx_v_self->max_depth) {
 
-    /* "pysam/csamtools.pyx":1897
+    /* "csamtools.pyx":1897
  * 
  *         if self.max_depth:
  *             bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )             # <<<<<<<<<<<<<<
@@ -19523,7 +18322,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
   }
   __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":1899
+  /* "csamtools.pyx":1899
  *             bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )
  * 
  *         bam_plp_set_mask( self.pileup_iter, self.mask )             # <<<<<<<<<<<<<<
@@ -19540,7 +18339,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumn.setupIteratorData", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumn.setupIteratorData", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -19549,7 +18348,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":1901
+/* "csamtools.pyx":1901
  *         bam_plp_set_mask( self.pileup_iter, self.mask )
  * 
  *     cdef reset( self, tid, start, end ):             # <<<<<<<<<<<<<<
@@ -19557,22 +18356,21 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData(st
  * 
  */
 
-static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_reset(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_tid, PyObject *__pyx_v_start, PyObject *__pyx_v_end) {
+static PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_tid, PyObject *__pyx_v_start, PyObject *__pyx_v_end) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  bam_iter_t __pyx_t_4;
-  int __pyx_t_5;
+  int __pyx_t_4;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":1907
+  /* "csamtools.pyx":1907
  *         having to incur the full set-up costs.
  *         '''
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 )             # <<<<<<<<<<<<<<
@@ -19580,7 +18378,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_reset(struct __pyx_o
  * 
  */
   __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));
@@ -19596,27 +18394,26 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_reset(struct __pyx_o
   __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_5pysam_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;
   __Pyx_GIVEREF(__pyx_t_3);
   __Pyx_GOTREF(__pyx_v_self->iter);
   __Pyx_DECREF(((PyObject *)__pyx_v_self->iter));
-  __pyx_v_self->iter = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)__pyx_t_3);
+  __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_3);
   __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":1908
+  /* "csamtools.pyx":1908
  *         '''
  *         self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 )
  *         self.iterdata.iter = self.iter.iter             # <<<<<<<<<<<<<<
  * 
  *         # invalidate sequence if different tid
  */
-  __pyx_t_4 = __pyx_v_self->iter->iter;
-  __pyx_v_self->iterdata.iter = __pyx_t_4;
+  __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter;
 
-  /* "pysam/csamtools.pyx":1911
+  /* "csamtools.pyx":1911
  * 
  *         # invalidate sequence if different tid
  *         if self.tid != tid:             # <<<<<<<<<<<<<<
@@ -19625,27 +18422,28 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_reset(struct __pyx_o
  */
   __pyx_t_3 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_tid, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_tid, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __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 = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (__pyx_t_5) {
+  if (__pyx_t_4) {
 
-    /* "pysam/csamtools.pyx":1912
+    /* "csamtools.pyx":1912
  *         # invalidate sequence if different tid
  *         if self.tid != tid:
  *             if self.iterdata.seq != NULL: free( self.iterdata.seq )             # <<<<<<<<<<<<<<
  *             self.iterdata.seq = NULL
  *             self.iterdata.tid = -1
  */
-    __pyx_t_5 = (__pyx_v_self->iterdata.seq != NULL);
-    if (__pyx_t_5) {
+    __pyx_t_4 = (__pyx_v_self->iterdata.seq != NULL);
+    if (__pyx_t_4) {
       free(__pyx_v_self->iterdata.seq);
       goto __pyx_L4;
     }
     __pyx_L4:;
 
-    /* "pysam/csamtools.pyx":1913
+    /* "csamtools.pyx":1913
  *         if self.tid != tid:
  *             if self.iterdata.seq != NULL: free( self.iterdata.seq )
  *             self.iterdata.seq = NULL             # <<<<<<<<<<<<<<
@@ -19654,7 +18452,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_reset(struct __pyx_o
  */
     __pyx_v_self->iterdata.seq = NULL;
 
-    /* "pysam/csamtools.pyx":1914
+    /* "csamtools.pyx":1914
  *             if self.iterdata.seq != NULL: free( self.iterdata.seq )
  *             self.iterdata.seq = NULL
  *             self.iterdata.tid = -1             # <<<<<<<<<<<<<<
@@ -19666,7 +18464,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_reset(struct __pyx_o
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":1917
+  /* "csamtools.pyx":1917
  * 
  *         # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata )
  *         bam_plp_reset(self.pileup_iter)             # <<<<<<<<<<<<<<
@@ -19681,7 +18479,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_reset(struct __pyx_o
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumn.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumn.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -19690,16 +18488,7 @@ static PyObject *__pyx_f_5pysam_9csamtools_14IteratorColumn_reset(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_5pysam_9csamtools_14IteratorColumn_9__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5pysam_9csamtools_14IteratorColumn_9__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_5pysam_9csamtools_14IteratorColumn_8__dealloc__(((struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "pysam/csamtools.pyx":1919
+/* "csamtools.pyx":1919
  *         bam_plp_reset(self.pileup_iter)
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -19707,109 +18496,123 @@ static void __pyx_pw_5pysam_9csamtools_14IteratorColumn_9__dealloc__(PyObject *_
  *         # not been fully consumed
  */
 
-static void __pyx_pf_5pysam_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":1922
+  /* "csamtools.pyx":1922
  *         # reset in order to avoid memory leak messages for iterators that have
  *         # not been fully consumed
  *         if self.pileup_iter != <bam_plp_t>NULL:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":1923
+    /* "csamtools.pyx":1923
  *         # not been fully consumed
  *         if self.pileup_iter != <bam_plp_t>NULL:
  *             bam_plp_reset(self.pileup_iter)             # <<<<<<<<<<<<<<
  *             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);
 
-    /* "pysam/csamtools.pyx":1924
+    /* "csamtools.pyx":1924
  *         if self.pileup_iter != <bam_plp_t>NULL:
  *             bam_plp_reset(self.pileup_iter)
  *             bam_plp_destroy(self.pileup_iter)             # <<<<<<<<<<<<<<
  *             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);
 
-    /* "pysam/csamtools.pyx":1925
+    /* "csamtools.pyx":1925
  *             bam_plp_reset(self.pileup_iter)
  *             bam_plp_destroy(self.pileup_iter)
  *             self.pileup_iter = <bam_plp_t>NULL             # <<<<<<<<<<<<<<
  * 
  *         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:;
 
-  /* "pysam/csamtools.pyx":1927
+  /* "csamtools.pyx":1927
  *             self.pileup_iter = <bam_plp_t>NULL
  * 
  *         if self.iterdata.seq != NULL:             # <<<<<<<<<<<<<<
  *             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) {
 
-    /* "pysam/csamtools.pyx":1928
+    /* "csamtools.pyx":1928
  * 
  *         if self.iterdata.seq != NULL:
  *             free(self.iterdata.seq)             # <<<<<<<<<<<<<<
  *             self.iterdata.seq = NULL
  * 
  */
-    free(__pyx_v_self->iterdata.seq);
+    free(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq);
 
-    /* "pysam/csamtools.pyx":1929
+    /* "csamtools.pyx":1929
  *         if self.iterdata.seq != NULL:
  *             free(self.iterdata.seq)
  *             self.iterdata.seq = NULL             # <<<<<<<<<<<<<<
  * 
  * 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_5pysam_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  CYTHON_UNUSED struct __pyx_obj_5pysam_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;
+  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);
   {
-    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* 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);
@@ -19819,9 +18622,10 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject
         default: goto __pyx_L5_argtuple_error;
       }
       kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -19845,7 +18649,7 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject
         }
       }
       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 (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)) {
@@ -19858,7 +18662,7 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject
         default: goto __pyx_L5_argtuple_error;
       }
     }
-    __pyx_v_samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[0]);
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
     if (values[1]) {
       __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
@@ -19878,7 +18682,7 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject
       __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 {
 
-      /* "pysam/csamtools.pyx":1938
+      /* "csamtools.pyx":1938
  *                   int start = 0,
  *                   int end = max_pos,
  *                   int truncate = False,             # <<<<<<<<<<<<<<
@@ -19893,42 +18697,13 @@ static int __pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject
   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumnRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_20IteratorColumnRegion___cinit__(((struct __pyx_obj_5pysam_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;
-}
-
-/* "pysam/csamtools.pyx":1934
- *     '''iterates over a region only.
- *     '''
- *     def __cinit__(self, Samfile samfile,             # <<<<<<<<<<<<<<
- *                   int tid = 0,
- *                   int start = 0,
- */
-
-static int __pyx_pf_5pysam_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_5pysam_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_5pysam_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);
+  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;}
 
-  /* "pysam/csamtools.pyx":1942
+  /* "csamtools.pyx":1942
  * 
  *         # initialize iterator
  *         self.setupIteratorData( tid, start, end, 1 )             # <<<<<<<<<<<<<<
@@ -19937,65 +18712,51 @@ static int __pyx_pf_5pysam_9csamtools_20IteratorColumnRegion___cinit__(struct __
  */
   __pyx_t_2.__pyx_n = 1;
   __pyx_t_2.reopen = 1;
-  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnRegion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_5pysam_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;
 
-  /* "pysam/csamtools.pyx":1943
+  /* "csamtools.pyx":1943
  *         # initialize iterator
  *         self.setupIteratorData( tid, start, end, 1 )
  *         self.start = start             # <<<<<<<<<<<<<<
  *         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;
 
-  /* "pysam/csamtools.pyx":1944
+  /* "csamtools.pyx":1944
  *         self.setupIteratorData( tid, start, end, 1 )
  *         self.start = start
  *         self.end = end             # <<<<<<<<<<<<<<
  *         self.truncate = truncate
  * 
  */
-  __pyx_v_self->end = __pyx_v_end;
+  ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->end = __pyx_v_end;
 
-  /* "pysam/csamtools.pyx":1945
+  /* "csamtools.pyx":1945
  *         self.start = start
  *         self.end = end
  *         self.truncate = truncate             # <<<<<<<<<<<<<<
  * 
  *     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;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumnRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __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_5pysam_9csamtools_20IteratorColumnRegion_3__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_20IteratorColumnRegion_2__next__[] = "python version of next().\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
-struct wrapperbase __pyx_wrapperbase_5pysam_9csamtools_20IteratorColumnRegion_2__next__;
-#endif
-static PyObject *__pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_3__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_20IteratorColumnRegion_2__next__(((struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1947
+/* "csamtools.pyx":1947
  *         self.truncate = truncate
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -20003,7 +18764,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_3__next__(PyO
  *         """
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorColumnRegion_2__next__(struct __pyx_obj_5pysam_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;
@@ -20012,10 +18776,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorColumnRegion_2__next__(str
   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);
 
-  /* "pysam/csamtools.pyx":1951
+  /* "csamtools.pyx":1951
  *         """
  * 
  *         while 1:             # <<<<<<<<<<<<<<
@@ -20025,26 +18789,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorColumnRegion_2__next__(str
   while (1) {
     if (!1) break;
 
-    /* "pysam/csamtools.pyx":1952
+    /* "csamtools.pyx":1952
  * 
  *         while 1:
  *             self.cnext()             # <<<<<<<<<<<<<<
  *             if self.n_plp < 0:
  *                 raise ValueError("error during iteration" )
  */
-    ((struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnRegion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_5pysam_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));
 
-    /* "pysam/csamtools.pyx":1953
+    /* "csamtools.pyx":1953
  *         while 1:
  *             self.cnext()
  *             if self.n_plp < 0:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":1954
+      /* "csamtools.pyx":1954
  *             self.cnext()
  *             if self.n_plp < 0:
  *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
@@ -20056,21 +18820,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorColumnRegion_2__next__(str
       __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:;
 
-    /* "pysam/csamtools.pyx":1956
+    /* "csamtools.pyx":1956
  *                 raise ValueError("error during iteration" )
  * 
  *             if self.plp == NULL:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":1957
+      /* "csamtools.pyx":1957
  * 
  *             if self.plp == NULL:
  *                 raise StopIteration             # <<<<<<<<<<<<<<
@@ -20079,52 +18843,52 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorColumnRegion_2__next__(str
  */
       __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:;
 
-    /* "pysam/csamtools.pyx":1959
+    /* "csamtools.pyx":1959
  *                 raise StopIteration
  * 
  *             if self.truncate:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":1960
+      /* "csamtools.pyx":1960
  * 
  *             if self.truncate:
  *                 if self.start < self.pos: continue             # <<<<<<<<<<<<<<
  *                 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:;
 
-      /* "pysam/csamtools.pyx":1961
+      /* "csamtools.pyx":1961
  *             if self.truncate:
  *                 if self.start < self.pos: continue
  *                 if self.pos >= self.end: raise StopIteration             # <<<<<<<<<<<<<<
  * 
  *             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:;
 
-    /* "pysam/csamtools.pyx":1963
+    /* "csamtools.pyx":1963
  *                 if self.pos >= self.end: raise StopIteration
  * 
  *             return makePileupProxy( &self.plp,             # <<<<<<<<<<<<<<
@@ -20133,26 +18897,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorColumnRegion_2__next__(str
  */
     __Pyx_XDECREF(__pyx_r);
 
-    /* "pysam/csamtools.pyx":1966
+    /* "csamtools.pyx":1966
  *                                      self.tid,
  *                                      self.pos,
  *                                      self.n_plp )             # <<<<<<<<<<<<<<
  * 
  * cdef class IteratorColumnAllRefs(IteratorColumn):
  */
-    __pyx_t_2 = __pyx_f_5pysam_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);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumnRegion.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20161,86 +18925,71 @@ static PyObject *__pyx_pf_5pysam_9csamtools_20IteratorColumnRegion_2__next__(str
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_21IteratorColumnAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_9csamtools_21IteratorColumnAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile = 0;
-  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
+/* "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;
+  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--;
+        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;
     } else {
       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
     }
-    __pyx_v_samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[0]);
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumnAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs___cinit__(((struct __pyx_obj_5pysam_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;
-}
+  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;}
 
-/* "pysam/csamtools.pyx":1972
- *     """
- * 
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   Samfile samfile,
- *                   **kwargs ):
- */
-
-static int __pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs *__pyx_v_self, struct __pyx_obj_5pysam_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_5pysam_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);
-
-  /* "pysam/csamtools.pyx":1977
+  /* "csamtools.pyx":1977
  * 
  *         # no iteration over empty files
  *         if not samfile.nreferences: raise StopIteration             # <<<<<<<<<<<<<<
@@ -20255,11 +19004,11 @@ static int __pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs___cinit__(struct _
   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:;
 
-  /* "pysam/csamtools.pyx":1980
+  /* "csamtools.pyx":1980
  * 
  *         # initialize iterator
  *         self.setupIteratorData( self.tid, 0, max_pos, 1 )             # <<<<<<<<<<<<<<
@@ -20268,7 +19017,7 @@ static int __pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs___cinit__(struct _
  */
   __pyx_t_4.__pyx_n = 1;
   __pyx_t_4.reopen = 1;
-  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_self->__pyx_base.tid, 0, __pyx_v_5pysam_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;
 
@@ -20276,30 +19025,16 @@ static int __pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs___cinit__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumnAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __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_5pysam_9csamtools_21IteratorColumnAllRefs_3__next__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__[] = "python version of next().\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
-struct wrapperbase __pyx_wrapperbase_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__;
-#endif
-static PyObject *__pyx_pw_5pysam_9csamtools_21IteratorColumnAllRefs_3__next__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(((struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":1982
+/* "csamtools.pyx":1982
  *         self.setupIteratorData( self.tid, 0, max_pos, 1 )
  * 
  *     def __next__(self):             # <<<<<<<<<<<<<<
@@ -20307,22 +19042,25 @@ static PyObject *__pyx_pw_5pysam_9csamtools_21IteratorColumnAllRefs_3__next__(Py
  *         """
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(struct __pyx_obj_5pysam_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;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
-  struct __pyx_opt_args_5pysam_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_5;
+  struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_5;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":1986
+  /* "csamtools.pyx":1986
  *         """
  * 
  *         while 1:             # <<<<<<<<<<<<<<
@@ -20332,26 +19070,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(st
   while (1) {
     if (!1) break;
 
-    /* "pysam/csamtools.pyx":1987
+    /* "csamtools.pyx":1987
  * 
  *         while 1:
  *             self.cnext()             # <<<<<<<<<<<<<<
  * 
  *             if self.n_plp < 0:
  */
-    ((struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_5pysam_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));
 
-    /* "pysam/csamtools.pyx":1989
+    /* "csamtools.pyx":1989
  *             self.cnext()
  * 
  *             if self.n_plp < 0:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":1990
+      /* "csamtools.pyx":1990
  * 
  *             if self.n_plp < 0:
  *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
@@ -20363,21 +19101,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(st
       __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:;
 
-    /* "pysam/csamtools.pyx":1993
+    /* "csamtools.pyx":1993
  * 
  *             # return result, if within same reference
  *             if self.plp != NULL:             # <<<<<<<<<<<<<<
  *                 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) {
 
-      /* "pysam/csamtools.pyx":1994
+      /* "csamtools.pyx":1994
  *             # return result, if within same reference
  *             if self.plp != NULL:
  *                 return makePileupProxy( &self.plp,             # <<<<<<<<<<<<<<
@@ -20386,50 +19124,51 @@ static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(st
  */
       __Pyx_XDECREF(__pyx_r);
 
-      /* "pysam/csamtools.pyx":1997
+      /* "csamtools.pyx":1997
  *                                          self.tid,
  *                                          self.pos,
  *                                          self.n_plp )             # <<<<<<<<<<<<<<
  * 
  *             # otherwise, proceed to next reference or stop
  */
-      __pyx_t_2 = __pyx_f_5pysam_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:;
 
-    /* "pysam/csamtools.pyx":2000
+    /* "csamtools.pyx":2000
  * 
  *             # otherwise, proceed to next reference or stop
  *             self.tid += 1             # <<<<<<<<<<<<<<
  *             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);
 
-    /* "pysam/csamtools.pyx":2001
+    /* "csamtools.pyx":2001
  *             # otherwise, proceed to next reference or stop
  *             self.tid += 1
  *             if self.tid < self.samfile.nreferences:             # <<<<<<<<<<<<<<
  *                 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); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2002
+      /* "csamtools.pyx":2002
  *             self.tid += 1
  *             if self.tid < self.samfile.nreferences:
  *                 self.setupIteratorData( self.tid, 0, max_pos, 0 )             # <<<<<<<<<<<<<<
@@ -20438,14 +19177,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(st
  */
       __pyx_t_5.__pyx_n = 1;
       __pyx_t_5.reopen = 0;
-      __pyx_t_4 = ((struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_self->__pyx_base.tid, 0, __pyx_v_5pysam_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*/ {
 
-      /* "pysam/csamtools.pyx":2004
+      /* "csamtools.pyx":2004
  *                 self.setupIteratorData( self.tid, 0, max_pos, 0 )
  *             else:
  *                 raise StopIteration             # <<<<<<<<<<<<<<
@@ -20455,7 +19194,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(st
       __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);
@@ -20464,7 +19203,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(st
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.IteratorColumnAllRefs.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -20473,7 +19212,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(st
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":2009
+/* "csamtools.pyx":2009
  * ##-------------------------------------------------------------------
  * ##-------------------------------------------------------------------
  * cdef inline int32_t query_start(bam1_t *src) except -1:             # <<<<<<<<<<<<<<
@@ -20481,7 +19220,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__(st
  *     cdef uint32_t k
  */
 
-static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx_v_src) {
+static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src) {
   uint32_t *__pyx_v_cigar_p;
   uint32_t __pyx_v_op;
   uint32_t __pyx_v_k;
@@ -20494,10 +19233,10 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
   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);
 
-  /* "pysam/csamtools.pyx":2012
+  /* "csamtools.pyx":2012
  *     cdef uint32_t * cigar_p, op
  *     cdef uint32_t k
  *     cdef uint32_t start_offset = 0             # <<<<<<<<<<<<<<
@@ -20506,7 +19245,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
  */
   __pyx_v_start_offset = 0;
 
-  /* "pysam/csamtools.pyx":2014
+  /* "csamtools.pyx":2014
  *     cdef uint32_t start_offset = 0
  * 
  *     if src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -20515,7 +19254,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
  */
   if (__pyx_v_src->core.n_cigar) {
 
-    /* "pysam/csamtools.pyx":2015
+    /* "csamtools.pyx":2015
  * 
  *     if src.core.n_cigar:
  *         cigar_p = bam1_cigar(src);             # <<<<<<<<<<<<<<
@@ -20524,7 +19263,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
  */
     __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-    /* "pysam/csamtools.pyx":2016
+    /* "csamtools.pyx":2016
  *     if src.core.n_cigar:
  *         cigar_p = bam1_cigar(src);
  *         for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -20534,7 +19273,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
     __pyx_t_1 = __pyx_v_src->core.n_cigar;
     for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) {
 
-      /* "pysam/csamtools.pyx":2017
+      /* "csamtools.pyx":2017
  *         cigar_p = bam1_cigar(src);
  *         for k from 0 <= k < src.core.n_cigar:
  *             op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -20543,7 +19282,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
  */
       __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-      /* "pysam/csamtools.pyx":2022
+      /* "csamtools.pyx":2022
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
@@ -20552,7 +19291,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
  */
       switch (__pyx_v_op) {
 
-        /* "pysam/csamtools.pyx":2018
+        /* "csamtools.pyx":2018
  *         for k from 0 <= k < src.core.n_cigar:
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             if op==BAM_CHARD_CLIP:             # <<<<<<<<<<<<<<
@@ -20561,7 +19300,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
  */
         case 5:
 
-        /* "pysam/csamtools.pyx":2019
+        /* "csamtools.pyx":2019
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             if op==BAM_CHARD_CLIP:
  *                 if start_offset!=0 and start_offset!=src.core.l_qseq:             # <<<<<<<<<<<<<<
@@ -20577,7 +19316,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
         }
         if (__pyx_t_4) {
 
-          /* "pysam/csamtools.pyx":2020
+          /* "csamtools.pyx":2020
  *             if op==BAM_CHARD_CLIP:
  *                 if start_offset!=0 and start_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')             # <<<<<<<<<<<<<<
@@ -20589,7 +19328,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
           PyErr_SetString(__pyx_t_5, __pyx_k_132);
           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-          /* "pysam/csamtools.pyx":2021
+          /* "csamtools.pyx":2021
  *                 if start_offset!=0 and start_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1             # <<<<<<<<<<<<<<
@@ -20603,7 +19342,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
         __pyx_L6:;
         break;
 
-        /* "pysam/csamtools.pyx":2022
+        /* "csamtools.pyx":2022
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
@@ -20612,7 +19351,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
  */
         case 4:
 
-        /* "pysam/csamtools.pyx":2023
+        /* "csamtools.pyx":2023
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:
  *                 start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
@@ -20623,7 +19362,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
         break;
         default:
 
-        /* "pysam/csamtools.pyx":2025
+        /* "csamtools.pyx":2025
  *                 start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
  *             else:
  *                 break             # <<<<<<<<<<<<<<
@@ -20639,7 +19378,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":2027
+  /* "csamtools.pyx":2027
  *                 break
  * 
  *     return start_offset             # <<<<<<<<<<<<<<
@@ -20656,7 +19395,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":2032
+/* "csamtools.pyx":2032
  * ##-------------------------------------------------------------------
  * ##-------------------------------------------------------------------
  * cdef inline int32_t query_end(bam1_t *src) except -1:             # <<<<<<<<<<<<<<
@@ -20664,43 +19403,41 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_start(bam1_t *__pyx
  *     cdef uint32_t k
  */
 
-static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v_src) {
+static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
   uint32_t *__pyx_v_cigar_p;
   uint32_t __pyx_v_op;
   uint32_t __pyx_v_k;
   uint32_t __pyx_v_end_offset;
   int32_t __pyx_r;
   __Pyx_RefNannyDeclarations
-  int32_t __pyx_t_1;
+  int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   __Pyx_TraceDeclarations
-  __Pyx_RefNannySetupContext("query_end", 0);
+  __Pyx_RefNannySetupContext("query_end");
   __Pyx_TraceCall("query_end", __pyx_f[0], 2032);
 
-  /* "pysam/csamtools.pyx":2035
+  /* "csamtools.pyx":2035
  *     cdef uint32_t * cigar_p, op
  *     cdef uint32_t k
  *     cdef uint32_t end_offset = src.core.l_qseq             # <<<<<<<<<<<<<<
  * 
  *     if src.core.n_cigar>1:
  */
-  __pyx_t_1 = __pyx_v_src->core.l_qseq;
-  __pyx_v_end_offset = __pyx_t_1;
+  __pyx_v_end_offset = __pyx_v_src->core.l_qseq;
 
-  /* "pysam/csamtools.pyx":2037
+  /* "csamtools.pyx":2037
  *     cdef uint32_t end_offset = src.core.l_qseq
  * 
  *     if src.core.n_cigar>1:             # <<<<<<<<<<<<<<
  *         cigar_p = bam1_cigar(src);
  *         for k from src.core.n_cigar > k >= 1:
  */
-  __pyx_t_2 = (__pyx_v_src->core.n_cigar > 1);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.n_cigar > 1);
+  if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":2038
+    /* "csamtools.pyx":2038
  * 
  *     if src.core.n_cigar>1:
  *         cigar_p = bam1_cigar(src);             # <<<<<<<<<<<<<<
@@ -20709,7 +19446,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
  */
     __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-    /* "pysam/csamtools.pyx":2039
+    /* "csamtools.pyx":2039
  *     if src.core.n_cigar>1:
  *         cigar_p = bam1_cigar(src);
  *         for k from src.core.n_cigar > k >= 1:             # <<<<<<<<<<<<<<
@@ -20718,7 +19455,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
  */
     for (__pyx_v_k = __pyx_v_src->core.n_cigar-1; __pyx_v_k >= 1; __pyx_v_k--) {
 
-      /* "pysam/csamtools.pyx":2040
+      /* "csamtools.pyx":2040
  *         cigar_p = bam1_cigar(src);
  *         for k from src.core.n_cigar > k >= 1:
  *             op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -20727,7 +19464,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
  */
       __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-      /* "pysam/csamtools.pyx":2045
+      /* "csamtools.pyx":2045
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
@@ -20736,7 +19473,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
  */
       switch (__pyx_v_op) {
 
-        /* "pysam/csamtools.pyx":2041
+        /* "csamtools.pyx":2041
  *         for k from src.core.n_cigar > k >= 1:
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             if op==BAM_CHARD_CLIP:             # <<<<<<<<<<<<<<
@@ -20745,35 +19482,35 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
  */
         case 5:
 
-        /* "pysam/csamtools.pyx":2042
+        /* "csamtools.pyx":2042
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             if op==BAM_CHARD_CLIP:
  *                 if end_offset!=0 and end_offset!=src.core.l_qseq:             # <<<<<<<<<<<<<<
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1
  */
-        __pyx_t_2 = (__pyx_v_end_offset != 0);
-        if (__pyx_t_2) {
-          __pyx_t_3 = (__pyx_v_end_offset != __pyx_v_src->core.l_qseq);
-          __pyx_t_4 = __pyx_t_3;
+        __pyx_t_1 = (__pyx_v_end_offset != 0);
+        if (__pyx_t_1) {
+          __pyx_t_2 = (__pyx_v_end_offset != __pyx_v_src->core.l_qseq);
+          __pyx_t_3 = __pyx_t_2;
         } else {
-          __pyx_t_4 = __pyx_t_2;
+          __pyx_t_3 = __pyx_t_1;
         }
-        if (__pyx_t_4) {
+        if (__pyx_t_3) {
 
-          /* "pysam/csamtools.pyx":2043
+          /* "csamtools.pyx":2043
  *             if op==BAM_CHARD_CLIP:
  *                 if end_offset!=0 and end_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')             # <<<<<<<<<<<<<<
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:
  */
-          __pyx_t_5 = __pyx_builtin_ValueError;
-          __Pyx_INCREF(__pyx_t_5);
-          PyErr_SetString(__pyx_t_5, __pyx_k_132);
-          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+          __pyx_t_4 = __pyx_builtin_ValueError;
+          __Pyx_INCREF(__pyx_t_4);
+          PyErr_SetString(__pyx_t_4, __pyx_k_132);
+          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-          /* "pysam/csamtools.pyx":2044
+          /* "csamtools.pyx":2044
  *                 if end_offset!=0 and end_offset!=src.core.l_qseq:
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1             # <<<<<<<<<<<<<<
@@ -20787,7 +19524,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
         __pyx_L6:;
         break;
 
-        /* "pysam/csamtools.pyx":2045
+        /* "csamtools.pyx":2045
  *                     PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:             # <<<<<<<<<<<<<<
@@ -20796,7 +19533,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
  */
         case 4:
 
-        /* "pysam/csamtools.pyx":2046
+        /* "csamtools.pyx":2046
  *                     return -1
  *             elif op==BAM_CSOFT_CLIP:
  *                 end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
@@ -20807,7 +19544,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
         break;
         default:
 
-        /* "pysam/csamtools.pyx":2048
+        /* "csamtools.pyx":2048
  *                 end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
  *             else:
  *                 break             # <<<<<<<<<<<<<<
@@ -20823,30 +19560,29 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":2050
+  /* "csamtools.pyx":2050
  *                 break
  * 
  *     if end_offset==0:             # <<<<<<<<<<<<<<
  *         end_offset = src.core.l_qseq
  * 
  */
-  __pyx_t_4 = (__pyx_v_end_offset == 0);
-  if (__pyx_t_4) {
+  __pyx_t_3 = (__pyx_v_end_offset == 0);
+  if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":2051
+    /* "csamtools.pyx":2051
  * 
  *     if end_offset==0:
  *         end_offset = src.core.l_qseq             # <<<<<<<<<<<<<<
  * 
  *     return end_offset
  */
-    __pyx_t_1 = __pyx_v_src->core.l_qseq;
-    __pyx_v_end_offset = __pyx_t_1;
+    __pyx_v_end_offset = __pyx_v_src->core.l_qseq;
     goto __pyx_L7;
   }
   __pyx_L7:;
 
-  /* "pysam/csamtools.pyx":2053
+  /* "csamtools.pyx":2053
  *         end_offset = src.core.l_qseq
  * 
  *     return end_offset             # <<<<<<<<<<<<<<
@@ -20863,7 +19599,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":2056
+/* "csamtools.pyx":2056
  * 
  * 
  * cdef inline object get_seq_range(bam1_t *src, uint32_t start, uint32_t end):             # <<<<<<<<<<<<<<
@@ -20871,7 +19607,7 @@ static CYTHON_INLINE int32_t __pyx_f_5pysam_9csamtools_query_end(bam1_t *__pyx_v
  *     cdef uint32_t k
  */
 
-static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *__pyx_v_src, uint32_t __pyx_v_start, uint32_t __pyx_v_end) {
+static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_src, uint32_t __pyx_v_start, uint32_t __pyx_v_end) {
   uint8_t *__pyx_v_p;
   uint32_t __pyx_v_k;
   char *__pyx_v_s;
@@ -20886,10 +19622,10 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
   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);
 
-  /* "pysam/csamtools.pyx":2061
+  /* "csamtools.pyx":2061
  *     cdef char * s
  * 
  *     if not src.core.l_qseq:             # <<<<<<<<<<<<<<
@@ -20899,7 +19635,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
   __pyx_t_1 = (!__pyx_v_src->core.l_qseq);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":2062
+    /* "csamtools.pyx":2062
  * 
  *     if not src.core.l_qseq:
  *         return None             # <<<<<<<<<<<<<<
@@ -20914,7 +19650,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":2064
+  /* "csamtools.pyx":2064
  *         return None
  * 
  *     seq = PyBytes_FromStringAndSize(NULL, end - start)             # <<<<<<<<<<<<<<
@@ -20926,7 +19662,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
   __pyx_v_seq = ((PyObject*)__pyx_t_2);
   __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":2065
+  /* "csamtools.pyx":2065
  * 
  *     seq = PyBytes_FromStringAndSize(NULL, end - start)
  *     s   = <char*>seq             # <<<<<<<<<<<<<<
@@ -20936,7 +19672,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
   __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_seq)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_s = ((char *)__pyx_t_3);
 
-  /* "pysam/csamtools.pyx":2066
+  /* "csamtools.pyx":2066
  *     seq = PyBytes_FromStringAndSize(NULL, end - start)
  *     s   = <char*>seq
  *     p   = bam1_seq(src)             # <<<<<<<<<<<<<<
@@ -20945,7 +19681,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
  */
   __pyx_v_p = bam1_seq(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2068
+  /* "csamtools.pyx":2068
  *     p   = bam1_seq(src)
  * 
  *     for k from start <= k < end:             # <<<<<<<<<<<<<<
@@ -20955,17 +19691,17 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
   __pyx_t_4 = __pyx_v_end;
   for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_4; __pyx_v_k++) {
 
-    /* "pysam/csamtools.pyx":2071
+    /* "csamtools.pyx":2071
  *         # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c)
  *         # note: do not use string literal as it will be a python string
  *         s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf]             # <<<<<<<<<<<<<<
  * 
  *     return seq
  */
-    (__pyx_v_s[(__pyx_v_k - __pyx_v_start)]) = (__pyx_v_5pysam_9csamtools_bam_nt16_rev_table[(((__pyx_v_p[__Pyx_div_long(__pyx_v_k, 2)]) >> (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))) & 0xf)]);
+    (__pyx_v_s[(__pyx_v_k - __pyx_v_start)]) = (__pyx_v_9csamtools_bam_nt16_rev_table[(((__pyx_v_p[__Pyx_div_long(__pyx_v_k, 2)]) >> (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))) & 0xf)]);
   }
 
-  /* "pysam/csamtools.pyx":2073
+  /* "csamtools.pyx":2073
  *         s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf]
  * 
  *     return seq             # <<<<<<<<<<<<<<
@@ -20981,7 +19717,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.get_seq_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.get_seq_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_seq);
@@ -20991,7 +19727,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
   return __pyx_r;
 }
 
-/* "pysam/csamtools.pyx":2076
+/* "csamtools.pyx":2076
  * 
  * 
  * cdef inline object get_qual_range(bam1_t *src, uint32_t start, uint32_t end):             # <<<<<<<<<<<<<<
@@ -20999,7 +19735,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_seq_range(bam1_t *_
  *     cdef uint32_t k
  */
 
-static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *__pyx_v_src, uint32_t __pyx_v_start, uint32_t __pyx_v_end) {
+static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v_src, uint32_t __pyx_v_start, uint32_t __pyx_v_end) {
   uint8_t *__pyx_v_p;
   uint32_t __pyx_v_k;
   char *__pyx_v_q;
@@ -21014,10 +19750,10 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
   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);
 
-  /* "pysam/csamtools.pyx":2081
+  /* "csamtools.pyx":2081
  *     cdef char * q
  * 
  *     p = bam1_qual(src)             # <<<<<<<<<<<<<<
@@ -21026,7 +19762,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
  */
   __pyx_v_p = bam1_qual(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2082
+  /* "csamtools.pyx":2082
  * 
  *     p = bam1_qual(src)
  *     if p[0] == 0xff:             # <<<<<<<<<<<<<<
@@ -21036,7 +19772,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
   __pyx_t_1 = ((__pyx_v_p[0]) == 0xff);
   if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":2083
+    /* "csamtools.pyx":2083
  *     p = bam1_qual(src)
  *     if p[0] == 0xff:
  *         return None             # <<<<<<<<<<<<<<
@@ -21051,7 +19787,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":2085
+  /* "csamtools.pyx":2085
  *         return None
  * 
  *     qual = PyBytes_FromStringAndSize(NULL, end - start)             # <<<<<<<<<<<<<<
@@ -21063,7 +19799,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
   __pyx_v_qual = ((PyObject*)__pyx_t_2);
   __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":2086
+  /* "csamtools.pyx":2086
  * 
  *     qual = PyBytes_FromStringAndSize(NULL, end - start)
  *     q    = <char*>qual             # <<<<<<<<<<<<<<
@@ -21073,7 +19809,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
   __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_qual)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_q = ((char *)__pyx_t_3);
 
-  /* "pysam/csamtools.pyx":2088
+  /* "csamtools.pyx":2088
  *     q    = <char*>qual
  * 
  *     for k from start <= k < end:             # <<<<<<<<<<<<<<
@@ -21083,7 +19819,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
   __pyx_t_4 = __pyx_v_end;
   for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_4; __pyx_v_k++) {
 
-    /* "pysam/csamtools.pyx":2090
+    /* "csamtools.pyx":2090
  *     for k from start <= k < end:
  *         ## equivalent to t[i] + 33 (see bam.c)
  *         q[k-start] = p[k] + 33             # <<<<<<<<<<<<<<
@@ -21093,7 +19829,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
     (__pyx_v_q[(__pyx_v_k - __pyx_v_start)]) = ((__pyx_v_p[__pyx_v_k]) + 33);
   }
 
-  /* "pysam/csamtools.pyx":2092
+  /* "csamtools.pyx":2092
  *         q[k-start] = p[k] + 33
  * 
  *     return qual             # <<<<<<<<<<<<<<
@@ -21109,7 +19845,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.get_qual_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.get_qual_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_qual);
@@ -21119,21 +19855,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5pysam_9csamtools_get_qual_range(bam1_t *
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead___init__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2124
+/* "csamtools.pyx":2124
  * 
  *     # Now only called when instances are created from Python
  *     def __init__(self):             # <<<<<<<<<<<<<<
@@ -21141,48 +19863,52 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_1__init__(PyObject *__pyx_v_
  *         self._delegate = <bam1_t*>calloc( 1, sizeof( bam1_t) )
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead___init__(struct __pyx_obj_5pysam_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;
 
-  /* "pysam/csamtools.pyx":2126
+  /* "csamtools.pyx":2126
  *     def __init__(self):
  *         # see bam_init1
  *         self._delegate = <bam1_t*>calloc( 1, sizeof( bam1_t) )             # <<<<<<<<<<<<<<
  *         # 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))));
 
-  /* "pysam/csamtools.pyx":2130
+  /* "csamtools.pyx":2130
  *         # If size is 0, calloc does not return a pointer that can be passed to free()
  *         # so allocate 40 bytes for a new read
  *         self._delegate.m_data = 40             # <<<<<<<<<<<<<<
  *         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;
 
-  /* "pysam/csamtools.pyx":2131
+  /* "csamtools.pyx":2131
  *         # so allocate 40 bytes for a new read
  *         self._delegate.m_data = 40
  *         self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )             # <<<<<<<<<<<<<<
  *         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));
 
-  /* "pysam/csamtools.pyx":2132
+  /* "csamtools.pyx":2132
  *         self._delegate.m_data = 40
  *         self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )
  *         self._delegate.data_len = 0             # <<<<<<<<<<<<<<
  * 
  *     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);
@@ -21190,16 +19916,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead___init__(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_5pysam_9csamtools_11AlignedRead_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5pysam_9csamtools_11AlignedRead_3__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_5pysam_9csamtools_11AlignedRead_2__dealloc__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "pysam/csamtools.pyx":2134
+/* "csamtools.pyx":2134
  *         self._delegate.data_len = 0
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -21207,41 +19924,27 @@ static void __pyx_pw_5pysam_9csamtools_11AlignedRead_3__dealloc__(PyObject *__py
  * 
  */
 
-static void __pyx_pf_5pysam_9csamtools_11AlignedRead_2__dealloc__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":2135
+  /* "csamtools.pyx":2135
  * 
  *     def __dealloc__(self):
  *         bam_destroy1(self._delegate)             # <<<<<<<<<<<<<<
  * 
  *     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_5pysam_9csamtools_11AlignedRead_5__str__(PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_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        ";
-#if CYTHON_COMPILING_IN_CPYTHON
-struct wrapperbase __pyx_wrapperbase_5pysam_9csamtools_11AlignedRead_4__str__;
-#endif
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5__str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2137
+/* "csamtools.pyx":2137
  *         bam_destroy1(self._delegate)
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -21249,7 +19952,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5__str__(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_5pysam_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;
@@ -21271,10 +19977,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
   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);
 
-  /* "pysam/csamtools.pyx":2149
+  /* "csamtools.pyx":2149
  *         # sam-parsing is done in sam.c/bam_format1_core which
  *         # requires a valid header.
  *         if sys.version_info[0] < 3:             # <<<<<<<<<<<<<<
@@ -21289,47 +19995,48 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
   __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __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 = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":2150
+    /* "csamtools.pyx":2150
  *         # requires a valid header.
  *         if sys.version_info[0] < 3:
  *             seq = self.seq             # <<<<<<<<<<<<<<
  *             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;
 
-    /* "pysam/csamtools.pyx":2151
+    /* "csamtools.pyx":2151
  *         if sys.version_info[0] < 3:
  *             seq = self.seq
  *             qual = self.qual             # <<<<<<<<<<<<<<
  *         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*/ {
 
-    /* "pysam/csamtools.pyx":2153
+    /* "csamtools.pyx":2153
  *             qual = self.qual
  *         else:
  *             seq = self.seq.decode('ascii')             # <<<<<<<<<<<<<<
  *             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);
@@ -21340,14 +20047,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
     __pyx_v_seq = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":2154
+    /* "csamtools.pyx":2154
  *         else:
  *             seq = self.seq.decode('ascii')
  *             qual = self.qual.decode('ascii')             # <<<<<<<<<<<<<<
  *         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);
@@ -21358,9 +20065,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
     __pyx_v_qual = __pyx_t_2;
     __pyx_t_2 = 0;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2155
+  /* "csamtools.pyx":2155
  *             seq = self.seq.decode('ascii')
  *             qual = self.qual.decode('ascii')
  *         return "\t".join(map(str, (self.qname,             # <<<<<<<<<<<<<<
@@ -21370,100 +20077,100 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
   __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);
 
-  /* "pysam/csamtools.pyx":2156
+  /* "csamtools.pyx":2156
  *             qual = self.qual.decode('ascii')
  *         return "\t".join(map(str, (self.qname,
  *                                    self.flag,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":2157
+  /* "csamtools.pyx":2157
  *         return "\t".join(map(str, (self.qname,
  *                                    self.flag,
  *                                    self.rname,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":2158
+  /* "csamtools.pyx":2158
  *                                    self.flag,
  *                                    self.rname,
  *                                    self.pos,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":2159
+  /* "csamtools.pyx":2159
  *                                    self.rname,
  *                                    self.pos,
  *                                    self.mapq,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":2160
+  /* "csamtools.pyx":2160
  *                                    self.pos,
  *                                    self.mapq,
  *                                    self.cigar,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":2161
+  /* "csamtools.pyx":2161
  *                                    self.mapq,
  *                                    self.cigar,
  *                                    self.mrnm,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":2162
+  /* "csamtools.pyx":2162
  *                                    self.cigar,
  *                                    self.mrnm,
  *                                    self.mpos,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":2163
+  /* "csamtools.pyx":2163
  *                                    self.mrnm,
  *                                    self.mpos,
  *                                    self.rlen,             # <<<<<<<<<<<<<<
  *                                    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);
 
-  /* "pysam/csamtools.pyx":2166
+  /* "csamtools.pyx":2166
  *                                    seq,
  *                                    qual,
  *                                    self.tags )))             # <<<<<<<<<<<<<<
  * 
  *     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);
@@ -21501,7 +20208,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
   __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))));
@@ -21512,7 +20219,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
   __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;
@@ -21539,7 +20246,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
   __Pyx_XDECREF(__pyx_t_11);
   __Pyx_XDECREF(__pyx_t_12);
   __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_seq);
@@ -21550,24 +20257,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4__str__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_7compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_11AlignedRead_6compare[] = "AlignedRead.compare(self, AlignedRead other)\nreturn -1,0,1, if contents in this are binary <,=,> to *other*";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_other));
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2168
+/* "csamtools.pyx":2168
  *                                    self.tags )))
  * 
  *     def compare(self, AlignedRead other):             # <<<<<<<<<<<<<<
@@ -21575,53 +20265,53 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_7compare(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_obj_5pysam_9csamtools_AlignedRead *__pyx_v_self, struct __pyx_obj_5pysam_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;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
   int __pyx_lineno = 0;
   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;}
 
-  /* "pysam/csamtools.pyx":2174
+  /* "csamtools.pyx":2174
  *         cdef bam1_t *t, *o
  * 
  *         t = self._delegate             # <<<<<<<<<<<<<<
  *         o = other._delegate
  * 
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_t = __pyx_t_1;
+  __pyx_v_t = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2175
+  /* "csamtools.pyx":2175
  * 
  *         t = self._delegate
  *         o = other._delegate             # <<<<<<<<<<<<<<
  * 
  *         # uncomment for debugging purposes
  */
-  __pyx_t_1 = __pyx_v_other->_delegate;
-  __pyx_v_o = __pyx_t_1;
+  __pyx_v_o = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_other)->_delegate;
 
-  /* "pysam/csamtools.pyx":2187
+  /* "csamtools.pyx":2187
  * 
  *         # Fast-path test for object identity
  *         if t==o:             # <<<<<<<<<<<<<<
  *             return 0
  * 
  */
-  __pyx_t_2 = (__pyx_v_t == __pyx_v_o);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_t == __pyx_v_o);
+  if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":2188
+    /* "csamtools.pyx":2188
  *         # Fast-path test for object identity
  *         if t==o:
  *             return 0             # <<<<<<<<<<<<<<
@@ -21632,11 +20322,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_
     __Pyx_INCREF(__pyx_int_0);
     __pyx_r = __pyx_int_0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2190
+  /* "csamtools.pyx":2190
  *             return 0
  * 
  *         retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t))             # <<<<<<<<<<<<<<
@@ -21645,7 +20335,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_
  */
   __pyx_v_retval = memcmp((&__pyx_v_t->core), (&__pyx_v_o->core), (sizeof(bam1_core_t)));
 
-  /* "pysam/csamtools.pyx":2192
+  /* "csamtools.pyx":2192
  *         retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t))
  * 
  *         if retval: return retval             # <<<<<<<<<<<<<<
@@ -21654,16 +20344,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_
  */
   if (__pyx_v_retval) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_r = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_t_2 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __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_L4;
+    goto __pyx_L6;
   }
-  __pyx_L4:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":2193
+  /* "csamtools.pyx":2193
  * 
  *         if retval: return retval
  *         retval = (t.data_len > o.data_len) - (t.data_len < o.data_len) # cmp(t.data_len, o.data_len)             # <<<<<<<<<<<<<<
@@ -21672,7 +20362,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_
  */
   __pyx_v_retval = ((__pyx_v_t->data_len > __pyx_v_o->data_len) - (__pyx_v_t->data_len < __pyx_v_o->data_len));
 
-  /* "pysam/csamtools.pyx":2194
+  /* "csamtools.pyx":2194
  *         if retval: return retval
  *         retval = (t.data_len > o.data_len) - (t.data_len < o.data_len) # cmp(t.data_len, o.data_len)
  *         if retval: return retval             # <<<<<<<<<<<<<<
@@ -21681,16 +20371,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_
  */
   if (__pyx_v_retval) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_r = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_t_2 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __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_L5;
+    goto __pyx_L7;
   }
-  __pyx_L5:;
+  __pyx_L7:;
 
-  /* "pysam/csamtools.pyx":2195
+  /* "csamtools.pyx":2195
  *         retval = (t.data_len > o.data_len) - (t.data_len < o.data_len) # cmp(t.data_len, o.data_len)
  *         if retval: return retval
  *         return memcmp(t.data, o.data, t.data_len)             # <<<<<<<<<<<<<<
@@ -21698,17 +20388,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_
  *     # Disabled so long as __cmp__ is a special method
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyInt_FromLong(memcmp(__pyx_v_t->data, __pyx_v_o->data, __pyx_v_t->data_len)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_r = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_t_2 = PyInt_FromLong(memcmp(__pyx_v_t->data, __pyx_v_o->data, __pyx_v_t->data_len)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.compare", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("csamtools.AlignedRead.compare", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21717,18 +20407,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6compare(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static Py_hash_t __pyx_pw_5pysam_9csamtools_11AlignedRead_9__hash__(PyObject *__pyx_v_self); /*proto*/
-static Py_hash_t __pyx_pw_5pysam_9csamtools_11AlignedRead_9__hash__(PyObject *__pyx_v_self) {
-  Py_hash_t __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_8__hash__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2198
+/* "csamtools.pyx":2198
  * 
  *     # Disabled so long as __cmp__ is a special method
  *     def __hash__(self):             # <<<<<<<<<<<<<<
@@ -21736,14 +20415,15 @@ static Py_hash_t __pyx_pw_5pysam_9csamtools_11AlignedRead_9__hash__(PyObject *__
  * 
  */
 
-static Py_hash_t __pyx_pf_5pysam_9csamtools_11AlignedRead_8__hash__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":2199
+  /* "csamtools.pyx":2199
  *     # Disabled so long as __cmp__ is a special method
  *     def __hash__(self):
  *         return _Py_HashPointer(<void *>self)             # <<<<<<<<<<<<<<
@@ -21761,18 +20441,7 @@ static Py_hash_t __pyx_pf_5pysam_9csamtools_11AlignedRead_8__hash__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5qname_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5qname_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2203
+/* "csamtools.pyx":2203
  *     property qname:
  *         """the query name (None if not present)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -21780,48 +20449,47 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5qname_1__get__(PyObje
  *             src = self._delegate
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5qname___get__(struct __pyx_obj_5pysam_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
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2205
+  /* "csamtools.pyx":2205
  *         def __get__(self):
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             if src.core.l_qname == 0: return None
  *             return _charptr_to_str(<char *>bam1_qname( src ))
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2206
+  /* "csamtools.pyx":2206
  *             cdef bam1_t * src
  *             src = self._delegate
  *             if src.core.l_qname == 0: return None             # <<<<<<<<<<<<<<
  *             return _charptr_to_str(<char *>bam1_qname( src ))
  * 
  */
-  __pyx_t_2 = (__pyx_v_src->core.l_qname == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.l_qname == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2207
+  /* "csamtools.pyx":2207
  *             src = self._delegate
  *             if src.core.l_qname == 0: return None
  *             return _charptr_to_str(<char *>bam1_qname( src ))             # <<<<<<<<<<<<<<
@@ -21829,17 +20497,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5qname___get__(struct
  *         def __set__(self, qname ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = __pyx_f_5pysam_9csamtools__charptr_to_str(((char *)bam1_qname(__pyx_v_src))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_r = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_t_2 = __pyx_f_9csamtools__charptr_to_str(((char *)bam1_qname(__pyx_v_src))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.qname.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("csamtools.AlignedRead.qname.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -21848,18 +20516,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5qname___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5qname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_5qname_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qname));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2209
+/* "csamtools.pyx":2209
  *             return _charptr_to_str(<char *>bam1_qname( src ))
  * 
  *         def __set__(self, qname ):             # <<<<<<<<<<<<<<
@@ -21867,7 +20524,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5qname_3__set__(PyObject *__
  *             qname = _force_bytes(qname)
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_5pysam_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;
@@ -21878,24 +20536,24 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx
   Py_ssize_t __pyx_t_3;
   int __pyx_t_4;
   int __pyx_t_5;
-  bam1_t *__pyx_t_6;
-  char *__pyx_t_7;
+  char *__pyx_t_6;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2210
+  /* "csamtools.pyx":2210
  * 
  *         def __set__(self, qname ):
  *             if qname == None or len(qname) == 0: return             # <<<<<<<<<<<<<<
  *             qname = _force_bytes(qname)
  *             cdef bam1_t * src
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qname, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qname, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!__pyx_t_2) {
@@ -21908,34 +20566,33 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx
   if (__pyx_t_5) {
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2211
+  /* "csamtools.pyx":2211
  *         def __set__(self, qname ):
  *             if qname == None or len(qname) == 0: return
  *             qname = _force_bytes(qname)             # <<<<<<<<<<<<<<
  *             cdef bam1_t * src
  *             cdef int l
  */
-  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_bytes(__pyx_v_qname)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_qname)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_v_qname);
   __pyx_v_qname = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":2216
+  /* "csamtools.pyx":2216
  *             cdef char * p
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             p = bam1_qname( src )
  * 
  */
-  __pyx_t_6 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_6;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2217
+  /* "csamtools.pyx":2217
  * 
  *             src = self._delegate
  *             p = bam1_qname( src )             # <<<<<<<<<<<<<<
@@ -21944,7 +20601,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx
  */
   __pyx_v_p = bam1_qname(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2220
+  /* "csamtools.pyx":2220
  * 
  *             # the qname is \0 terminated
  *             l = len(qname) + 1             # <<<<<<<<<<<<<<
@@ -21954,7 +20611,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx
   __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_l = (__pyx_t_3 + 1);
 
-  /* "pysam/csamtools.pyx":2224
+  /* "csamtools.pyx":2224
  *                               src.core.l_qname,
  *                               l,
  *                               <uint8_t*>p )             # <<<<<<<<<<<<<<
@@ -21963,7 +20620,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx
  */
   pysam_bam_update(__pyx_v_src, __pyx_v_src->core.l_qname, __pyx_v_l, ((uint8_t *)__pyx_v_p));
 
-  /* "pysam/csamtools.pyx":2226
+  /* "csamtools.pyx":2226
  *                               <uint8_t*>p )
  * 
  *             src.core.l_qname = l             # <<<<<<<<<<<<<<
@@ -21972,7 +20629,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx
  */
   __pyx_v_src->core.l_qname = __pyx_v_l;
 
-  /* "pysam/csamtools.pyx":2230
+  /* "csamtools.pyx":2230
  *             # re-acquire pointer to location in memory
  *             # as it might have moved
  *             p = bam1_qname(src)             # <<<<<<<<<<<<<<
@@ -21981,21 +20638,21 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx
  */
   __pyx_v_p = bam1_qname(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2232
+  /* "csamtools.pyx":2232
  *             p = bam1_qname(src)
  * 
  *             strncpy( p, qname, l )             # <<<<<<<<<<<<<<
  * 
  *     property cigar:
  */
-  __pyx_t_7 = PyBytes_AsString(__pyx_v_qname); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  strncpy(__pyx_v_p, __pyx_t_7, __pyx_v_l);
+  __pyx_t_6 = PyBytes_AsString(__pyx_v_qname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  strncpy(__pyx_v_p, __pyx_t_6, __pyx_v_l);
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.qname.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.qname.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_qname);
@@ -22004,18 +20661,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5cigar_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5cigar_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2259
+/* "csamtools.pyx":2259
  * 
  *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -22023,7 +20669,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5cigar_1__get__(PyObje
  *             cdef bam1_t * src
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_obj_5pysam_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;
@@ -22032,58 +20679,56 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar___get__(struct
   int __pyx_v_k;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  uint32_t __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  uint32_t __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2265
+  /* "csamtools.pyx":2265
  *             cdef int k
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             if src.core.n_cigar == 0: return None
  * 
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2266
+  /* "csamtools.pyx":2266
  * 
  *             src = self._delegate
  *             if src.core.n_cigar == 0: return None             # <<<<<<<<<<<<<<
  * 
  *             cigar = []
  */
-  __pyx_t_2 = (__pyx_v_src->core.n_cigar == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2268
+  /* "csamtools.pyx":2268
  *             if src.core.n_cigar == 0: return None
  * 
  *             cigar = []             # <<<<<<<<<<<<<<
  *             cigar_p = bam1_cigar(src);
  *             for k from 0 <= k < src.core.n_cigar:
  */
-  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_v_cigar = ((PyObject *)__pyx_t_3);
-  __pyx_t_3 = 0;
+  __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(((PyObject *)__pyx_t_2));
+  __pyx_v_cigar = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":2269
+  /* "csamtools.pyx":2269
  * 
  *             cigar = []
  *             cigar_p = bam1_cigar(src);             # <<<<<<<<<<<<<<
@@ -22092,64 +20737,64 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar___get__(struct
  */
   __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2270
+  /* "csamtools.pyx":2270
  *             cigar = []
  *             cigar_p = bam1_cigar(src);
  *             for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  */
-  __pyx_t_4 = __pyx_v_src->core.n_cigar;
-  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_4; __pyx_v_k++) {
+  __pyx_t_3 = __pyx_v_src->core.n_cigar;
+  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
 
-    /* "pysam/csamtools.pyx":2271
+    /* "csamtools.pyx":2271
  *             cigar_p = bam1_cigar(src);
  *             for k from 0 <= k < src.core.n_cigar:
  *                 op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 cigar.append((op, l))
  */
-    __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) & 15)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) & 15)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_XDECREF(__pyx_v_op);
-    __pyx_v_op = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_op = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":2272
+    /* "csamtools.pyx":2272
  *             for k from 0 <= k < src.core.n_cigar:
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  *                 cigar.append((op, l))
  *             return cigar
  */
-    __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_XDECREF(__pyx_v_l);
-    __pyx_v_l = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_l = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":2273
+    /* "csamtools.pyx":2273
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 cigar.append((op, l))             # <<<<<<<<<<<<<<
  *             return cigar
  * 
  */
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __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 = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_op);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_op);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_op);
     __Pyx_GIVEREF(__pyx_v_op);
     __Pyx_INCREF(__pyx_v_l);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_l);
+    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_l);
     __Pyx_GIVEREF(__pyx_v_l);
-    __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_cigar, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_cigar, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
 
-  /* "pysam/csamtools.pyx":2274
+  /* "csamtools.pyx":2274
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 cigar.append((op, l))
  *             return cigar             # <<<<<<<<<<<<<<
@@ -22164,9 +20809,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar___get__(struct
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.cigar.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("csamtools.AlignedRead.cigar.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_op);
@@ -22178,18 +20823,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5cigar_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_values));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2276
+/* "csamtools.pyx":2276
  *             return cigar
  * 
  *         def __set__(self, values ):             # <<<<<<<<<<<<<<
@@ -22197,7 +20831,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5cigar_3__set__(PyObject *__
  *             cdef uint32_t * p
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_5pysam_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;
@@ -22210,29 +20845,29 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
   Py_ssize_t __pyx_t_3;
   int __pyx_t_4;
   int __pyx_t_5;
-  bam1_t *__pyx_t_6;
-  PyObject *(*__pyx_t_7)(PyObject *);
+  PyObject *(*__pyx_t_6)(PyObject *);
+  PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
   PyObject *__pyx_t_9 = NULL;
   PyObject *__pyx_t_10 = NULL;
-  PyObject *__pyx_t_11 = NULL;
-  PyObject *(*__pyx_t_12)(PyObject *);
-  uint32_t __pyx_t_13;
+  PyObject *(*__pyx_t_11)(PyObject *);
+  uint32_t __pyx_t_12;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2277
+  /* "csamtools.pyx":2277
  * 
  *         def __set__(self, values ):
  *             if values == None or len(values) == 0: return             # <<<<<<<<<<<<<<
  *             cdef uint32_t * p
  *             cdef bam1_t * src
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_values, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_values, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!__pyx_t_2) {
@@ -22245,11 +20880,11 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
   if (__pyx_t_5) {
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2283
+  /* "csamtools.pyx":2283
  *             cdef int k
  * 
  *             k = 0             # <<<<<<<<<<<<<<
@@ -22258,17 +20893,16 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
  */
   __pyx_v_k = 0;
 
-  /* "pysam/csamtools.pyx":2285
+  /* "csamtools.pyx":2285
  *             k = 0
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  * 
  *             # get location of cigar string
  */
-  __pyx_t_6 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_6;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2288
+  /* "csamtools.pyx":2288
  * 
  *             # get location of cigar string
  *             p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -22277,7 +20911,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
  */
   __pyx_v_p = bam1_cigar(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2293
+  /* "csamtools.pyx":2293
  *             pysam_bam_update( src,
  *                               src.core.n_cigar * 4,
  *                               len(values) * 4,             # <<<<<<<<<<<<<<
@@ -22286,7 +20920,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
  */
   __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":2294
+  /* "csamtools.pyx":2294
  *                               src.core.n_cigar * 4,
  *                               len(values) * 4,
  *                               <uint8_t*>p )             # <<<<<<<<<<<<<<
@@ -22295,7 +20929,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
  */
   pysam_bam_update(__pyx_v_src, (__pyx_v_src->core.n_cigar * 4), (__pyx_t_3 * 4), ((uint8_t *)__pyx_v_p));
 
-  /* "pysam/csamtools.pyx":2297
+  /* "csamtools.pyx":2297
  * 
  *             # length is number of cigar operations, not bytes
  *             src.core.n_cigar = len(values)             # <<<<<<<<<<<<<<
@@ -22305,7 +20939,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
   __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_src->core.n_cigar = __pyx_t_3;
 
-  /* "pysam/csamtools.pyx":2301
+  /* "csamtools.pyx":2301
  *             # re-acquire pointer to location in memory
  *             # as it might have moved
  *             p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -22314,7 +20948,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
  */
   __pyx_v_p = bam1_cigar(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2304
+  /* "csamtools.pyx":2304
  * 
  *             # insert cigar operations
  *             for op, l in values:             # <<<<<<<<<<<<<<
@@ -22323,111 +20957,96 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
  */
   if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
     __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
-    __pyx_t_7 = NULL;
+    __pyx_t_6 = NULL;
   } else {
     __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_1)) {
+    if (PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_1)) {
+      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
+    } else if (PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
     } else {
-      __pyx_t_8 = __pyx_t_7(__pyx_t_1);
-      if (unlikely(!__pyx_t_8)) {
+      __pyx_t_7 = __pyx_t_6(__pyx_t_1);
+      if (unlikely(!__pyx_t_7)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(__pyx_t_7);
     }
-    if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
-      PyObject* sequence = __pyx_t_8;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
+    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
+      PyObject* sequence = __pyx_t_7;
       if (likely(PyTuple_CheckExact(sequence))) {
-        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
-        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
+        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
-        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
-        __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
+        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
+        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
       }
+      __Pyx_INCREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_t_9);
-      __Pyx_INCREF(__pyx_t_10);
-      #else
-      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    } else
-    {
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    } else {
       Py_ssize_t index = -1;
-      __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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;
-      __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;
+      __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_12 = NULL;
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      goto __pyx_L7_unpacking_done;
-      __pyx_L6_unpacking_failed:;
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __pyx_t_12 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      __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_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_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_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_9;
-    __pyx_t_9 = 0;
+    __pyx_v_op = __pyx_t_8;
+    __pyx_t_8 = 0;
     __Pyx_XDECREF(__pyx_v_l);
-    __pyx_v_l = __pyx_t_10;
-    __pyx_t_10 = 0;
+    __pyx_v_l = __pyx_t_9;
+    __pyx_t_9 = 0;
 
-    /* "pysam/csamtools.pyx":2305
+    /* "csamtools.pyx":2305
  *             # insert cigar operations
  *             for op, l in values:
  *                 p[k] = l << BAM_CIGAR_SHIFT | op             # <<<<<<<<<<<<<<
  *                 k += 1
  * 
  */
-    __pyx_t_8 = PyNumber_Lshift(__pyx_v_l, __pyx_int_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_10 = PyNumber_Or(__pyx_t_8, __pyx_v_op); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_13 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_10); if (unlikely((__pyx_t_13 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    (__pyx_v_p[__pyx_v_k]) = __pyx_t_13;
+    __pyx_t_7 = PyNumber_Lshift(__pyx_v_l, __pyx_int_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_9 = PyNumber_Or(__pyx_t_7, __pyx_v_op); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_12 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    (__pyx_v_p[__pyx_v_k]) = __pyx_t_12;
 
-    /* "pysam/csamtools.pyx":2306
+    /* "csamtools.pyx":2306
  *             for op, l in values:
  *                 p[k] = l << BAM_CIGAR_SHIFT | op
  *                 k += 1             # <<<<<<<<<<<<<<
@@ -22438,7 +21057,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":2309
+  /* "csamtools.pyx":2309
  * 
  *             ## setting the cigar string also updates the "bin" attribute
  *             src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, p))             # <<<<<<<<<<<<<<
@@ -22451,11 +21070,11 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.cigar.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.cigar.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_op);
@@ -22465,18 +21084,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_11cigarstring_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_11cigarstring_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2316
+/* "csamtools.pyx":2316
  *         Returns the empty string if not present.
  *         '''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -22484,7 +21092,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_11cigarstring_1__get__
  *             if c == None: return ""
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(struct __pyx_obj_5pysam_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;
@@ -22506,29 +21115,30 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
   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);
 
-  /* "pysam/csamtools.pyx":2317
+  /* "csamtools.pyx":2317
  *         '''
  *         def __get__(self):
  *             c = self.cigar             # <<<<<<<<<<<<<<
  *             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;
 
-  /* "pysam/csamtools.pyx":2318
+  /* "csamtools.pyx":2318
  *         def __get__(self):
  *             c = self.cigar
  *             if c == None: return ""             # <<<<<<<<<<<<<<
  *             else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c])
  * 
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_c, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_c, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
@@ -22536,11 +21146,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
     __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
     __pyx_r = ((PyObject *)__pyx_kp_s_16);
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":2319
+    /* "csamtools.pyx":2319
  *             c = self.cigar
  *             if c == None: return ""
  *             else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c])             # <<<<<<<<<<<<<<
@@ -22551,7 +21161,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
     __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;
@@ -22561,20 +21171,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
       __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;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
+      } else if (PyTuple_CheckExact(__pyx_t_4)) {
         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
       } else {
         __pyx_t_7 = __pyx_t_6(__pyx_t_4);
         if (unlikely(!__pyx_t_7)) {
@@ -22588,52 +21190,45 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
       }
       if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
         PyObject* sequence = __pyx_t_7;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        Py_ssize_t size = Py_SIZE(sequence);
-        #else
-        Py_ssize_t size = PySequence_Size(sequence);
-        #endif
-        if (unlikely(size != 2)) {
-          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        #if CYTHON_COMPILING_IN_CPYTHON
         if (likely(PyTuple_CheckExact(sequence))) {
+          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
           __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
           __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
         } else {
+          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
           __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
           __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
         }
         __Pyx_INCREF(__pyx_t_8);
         __Pyx_INCREF(__pyx_t_9);
-        #else
-        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      } else
-      {
+      } else {
         Py_ssize_t index = -1;
         __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __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_t_11 = NULL;
         __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;
-        __pyx_t_11 = NULL;
-        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+        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;
@@ -22642,10 +21237,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
       __pyx_v_y = __pyx_t_9;
       __pyx_t_9 = 0;
       __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_7 = PyInt_FromLong((__pyx_v_5pysam_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_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);
@@ -22655,12 +21250,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
       __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_135), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_7));
       __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-      if (unlikely(__Pyx_PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
     }
     __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));
@@ -22673,7 +21268,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
     __pyx_t_3 = 0;
     goto __pyx_L0;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -22685,7 +21280,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.cigarstring.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.cigarstring.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_c);
@@ -22697,18 +21292,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring___get__(
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_11cigarstring_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cigar); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_cigar));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2321
+/* "csamtools.pyx":2321
  *             else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c])
  * 
  *         def __set__(self, cigar):             # <<<<<<<<<<<<<<
@@ -22716,7 +21300,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_11cigarstring_3__set__(PyObj
  *             parts = CIGAR_REGEX.findall( cigar )
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx_obj_5pysam_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;
@@ -22738,17 +21323,18 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
   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);
 
-  /* "pysam/csamtools.pyx":2322
+  /* "csamtools.pyx":2322
  * 
  *         def __set__(self, cigar):
  *             if cigar == None or len(cigar) == 0: self.cigar = []             # <<<<<<<<<<<<<<
  *             parts = CIGAR_REGEX.findall( cigar )
  *             self.cigar = [ (CIGAR2CODE[ord(x)], int(y)) for x,y in parts ]
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_cigar, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_cigar, Py_None, Py_EQ); 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);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!__pyx_t_2) {
@@ -22760,14 +21346,14 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
   }
   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:;
 
-  /* "pysam/csamtools.pyx":2323
+  /* "csamtools.pyx":2323
  *         def __set__(self, cigar):
  *             if cigar == None or len(cigar) == 0: self.cigar = []
  *             parts = CIGAR_REGEX.findall( cigar )             # <<<<<<<<<<<<<<
@@ -22780,7 +21366,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
   __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);
@@ -22791,7 +21377,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
   __pyx_v_parts = __pyx_t_7;
   __pyx_t_7 = 0;
 
-  /* "pysam/csamtools.pyx":2324
+  /* "csamtools.pyx":2324
  *             if cigar == None or len(cigar) == 0: self.cigar = []
  *             parts = CIGAR_REGEX.findall( cigar )
  *             self.cigar = [ (CIGAR2CODE[ord(x)], int(y)) for x,y in parts ]             # <<<<<<<<<<<<<<
@@ -22799,7 +21385,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
  *     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;
@@ -22809,20 +21395,12 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
     __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;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_1)) {
+      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
+    } else if (PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
     } else {
       __pyx_t_6 = __pyx_t_8(__pyx_t_1);
       if (unlikely(!__pyx_t_6)) {
@@ -22836,52 +21414,45 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
     }
     if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
       PyObject* sequence = __pyx_t_6;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
+        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
       }
       __Pyx_INCREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_t_10);
-      #else
-      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    } else
-    {
+    } else {
       Py_ssize_t index = -1;
       __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __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_t_12 = NULL;
       __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;
-      __pyx_t_12 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      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;
@@ -22892,7 +21463,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
     __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);
@@ -22904,7 +21475,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
     __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);
@@ -22912,22 +21483,19 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
     __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);
     __Pyx_GIVEREF(__pyx_t_6);
     __pyx_t_10 = 0;
     __pyx_t_6 = 0;
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_7, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(PyList_Append(__pyx_t_7, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = ((PyObject *)__pyx_t_7);
-  __Pyx_INCREF(__pyx_t_1);
+  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;
-  if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   __pyx_r = 0;
   goto __pyx_L0;
@@ -22938,7 +21506,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.cigarstring.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.cigarstring.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_parts);
@@ -22949,18 +21517,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11cigarstring_2__set__(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3seq_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3seq_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2330
+/* "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."""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -22968,48 +21525,47 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3seq_1__get__(PyObject
  *             cdef char * s
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj_5pysam_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
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2333
+  /* "csamtools.pyx":2333
  *             cdef bam1_t * src
  *             cdef char * s
  *             src = self._delegate             # <<<<<<<<<<<<<<
  * 
  *             if src.core.l_qseq == 0: return None
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2335
+  /* "csamtools.pyx":2335
  *             src = self._delegate
  * 
  *             if src.core.l_qseq == 0: return None             # <<<<<<<<<<<<<<
  * 
  *             return get_seq_range(src, 0, src.core.l_qseq)
  */
-  __pyx_t_2 = (__pyx_v_src->core.l_qseq == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2337
+  /* "csamtools.pyx":2337
  *             if src.core.l_qseq == 0: return None
  * 
  *             return get_seq_range(src, 0, src.core.l_qseq)             # <<<<<<<<<<<<<<
@@ -23017,17 +21573,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3seq___get__(struct __
  *         def __set__(self,seq):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = __pyx_f_5pysam_9csamtools_get_seq_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_r = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_t_2 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.seq.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("csamtools.AlignedRead.seq.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -23036,18 +21592,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3seq___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_3seq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_3seq_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_seq));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2339
+/* "csamtools.pyx":2339
  *             return get_seq_range(src, 0, src.core.l_qseq)
  * 
  *         def __set__(self,seq):             # <<<<<<<<<<<<<<
@@ -23055,7 +21600,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_3seq_3__set__(PyObject *__py
  *             # if no quality information is present, the first byte says 0xff.
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_5pysam_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;
@@ -23070,26 +21616,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
   Py_ssize_t __pyx_t_3;
   int __pyx_t_4;
   int __pyx_t_5;
-  bam1_t *__pyx_t_6;
-  int __pyx_t_7;
-  char *__pyx_t_8;
-  long __pyx_t_9;
+  int __pyx_t_6;
+  char *__pyx_t_7;
+  long __pyx_t_8;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2343
+  /* "csamtools.pyx":2343
  *             # if no quality information is present, the first byte says 0xff.
  * 
  *             if seq == None or len(seq) == 0: return             # <<<<<<<<<<<<<<
  *             seq = _force_bytes(seq)
  *             cdef bam1_t * src
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_seq, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_seq, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (!__pyx_t_2) {
@@ -23102,34 +21648,33 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
   if (__pyx_t_5) {
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2344
+  /* "csamtools.pyx":2344
  * 
  *             if seq == None or len(seq) == 0: return
  *             seq = _force_bytes(seq)             # <<<<<<<<<<<<<<
  *             cdef bam1_t * src
  *             cdef uint8_t * p
  */
-  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_bytes(__pyx_v_seq)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_seq)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_v_seq);
   __pyx_v_seq = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":2350
+  /* "csamtools.pyx":2350
  *             cdef int l, k, nbytes_new, nbytes_old
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  * 
  *             l = len(seq)
  */
-  __pyx_t_6 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_6;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2352
+  /* "csamtools.pyx":2352
  *             src = self._delegate
  * 
  *             l = len(seq)             # <<<<<<<<<<<<<<
@@ -23139,7 +21684,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
   __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_l = __pyx_t_3;
 
-  /* "pysam/csamtools.pyx":2356
+  /* "csamtools.pyx":2356
  *             # as the sequence is stored in half-bytes, the total length (sequence
  *             # plus quality scores) is (l+1)/2 + l
  *             nbytes_new = (l+1)/2 + l             # <<<<<<<<<<<<<<
@@ -23148,7 +21693,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
  */
   __pyx_v_nbytes_new = (__Pyx_div_long((__pyx_v_l + 1), 2) + __pyx_v_l);
 
-  /* "pysam/csamtools.pyx":2357
+  /* "csamtools.pyx":2357
  *             # plus quality scores) is (l+1)/2 + l
  *             nbytes_new = (l+1)/2 + l
  *             nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq             # <<<<<<<<<<<<<<
@@ -23157,7 +21702,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
  */
   __pyx_v_nbytes_old = (__Pyx_div_long((__pyx_v_src->core.l_qseq + 1), 2) + __pyx_v_src->core.l_qseq);
 
-  /* "pysam/csamtools.pyx":2359
+  /* "csamtools.pyx":2359
  *             nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq
  *             # acquire pointer to location in memory
  *             p = bam1_seq( src )             # <<<<<<<<<<<<<<
@@ -23166,7 +21711,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
  */
   __pyx_v_p = bam1_seq(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2360
+  /* "csamtools.pyx":2360
  *             # acquire pointer to location in memory
  *             p = bam1_seq( src )
  *             src.core.l_qseq = l             # <<<<<<<<<<<<<<
@@ -23175,7 +21720,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
  */
   __pyx_v_src->core.l_qseq = __pyx_v_l;
 
-  /* "pysam/csamtools.pyx":2365
+  /* "csamtools.pyx":2365
  *                               nbytes_old,
  *                               nbytes_new,
  *                               p)             # <<<<<<<<<<<<<<
@@ -23184,7 +21729,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
  */
   pysam_bam_update(__pyx_v_src, __pyx_v_nbytes_old, __pyx_v_nbytes_new, __pyx_v_p);
 
-  /* "pysam/csamtools.pyx":2368
+  /* "csamtools.pyx":2368
  *             # re-acquire pointer to location in memory
  *             # as it might have moved
  *             p = bam1_seq( src )             # <<<<<<<<<<<<<<
@@ -23193,50 +21738,50 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
  */
   __pyx_v_p = bam1_seq(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2369
+  /* "csamtools.pyx":2369
  *             # as it might have moved
  *             p = bam1_seq( src )
  *             for k from 0 <= k < nbytes_new: p[k] = 0             # <<<<<<<<<<<<<<
  *             # convert to C string
  *             s = seq
  */
-  __pyx_t_7 = __pyx_v_nbytes_new;
-  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_7; __pyx_v_k++) {
+  __pyx_t_6 = __pyx_v_nbytes_new;
+  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) {
     (__pyx_v_p[__pyx_v_k]) = 0;
   }
 
-  /* "pysam/csamtools.pyx":2371
+  /* "csamtools.pyx":2371
  *             for k from 0 <= k < nbytes_new: p[k] = 0
  *             # convert to C string
  *             s = seq             # <<<<<<<<<<<<<<
  *             for k from 0 <= k < l:
  *                 p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)
  */
-  __pyx_t_8 = PyBytes_AsString(__pyx_v_seq); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_s = __pyx_t_8;
+  __pyx_t_7 = PyBytes_AsString(__pyx_v_seq); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_s = __pyx_t_7;
 
-  /* "pysam/csamtools.pyx":2372
+  /* "csamtools.pyx":2372
  *             # convert to C string
  *             s = seq
  *             for k from 0 <= k < l:             # <<<<<<<<<<<<<<
  *                 p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)
  * 
  */
-  __pyx_t_7 = __pyx_v_l;
-  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_7; __pyx_v_k++) {
+  __pyx_t_6 = __pyx_v_l;
+  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) {
 
-    /* "pysam/csamtools.pyx":2373
+    /* "csamtools.pyx":2373
  *             s = seq
  *             for k from 0 <= k < l:
  *                 p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)             # <<<<<<<<<<<<<<
  * 
  *             # erase qualities
  */
-    __pyx_t_9 = __Pyx_div_long(__pyx_v_k, 2);
-    (__pyx_v_p[__pyx_t_9]) = ((__pyx_v_p[__pyx_t_9]) | (pysam_translate_sequence((__pyx_v_s[__pyx_v_k])) << (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))));
+    __pyx_t_8 = __Pyx_div_long(__pyx_v_k, 2);
+    (__pyx_v_p[__pyx_t_8]) = ((__pyx_v_p[__pyx_t_8]) | (pysam_translate_sequence((__pyx_v_s[__pyx_v_k])) << (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))));
   }
 
-  /* "pysam/csamtools.pyx":2376
+  /* "csamtools.pyx":2376
  * 
  *             # erase qualities
  *             p = bam1_qual( src )             # <<<<<<<<<<<<<<
@@ -23245,7 +21790,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
  */
   __pyx_v_p = bam1_qual(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2377
+  /* "csamtools.pyx":2377
  *             # erase qualities
  *             p = bam1_qual( src )
  *             p[0] = 0xff             # <<<<<<<<<<<<<<
@@ -23258,7 +21803,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.seq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.seq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_seq);
@@ -23267,18 +21812,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qual_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qual_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2384
+/* "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."""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -23286,48 +21820,47 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qual_1__get__(PyObjec
  *             cdef bam1_t * src
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qual___get__(struct __pyx_obj_5pysam_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
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2389
+  /* "csamtools.pyx":2389
  *             cdef char * q
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  * 
  *             if src.core.l_qseq == 0: return None
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2391
+  /* "csamtools.pyx":2391
  *             src = self._delegate
  * 
  *             if src.core.l_qseq == 0: return None             # <<<<<<<<<<<<<<
  * 
  *             return get_qual_range(src, 0, src.core.l_qseq)
  */
-  __pyx_t_2 = (__pyx_v_src->core.l_qseq == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2393
+  /* "csamtools.pyx":2393
  *             if src.core.l_qseq == 0: return None
  * 
  *             return get_qual_range(src, 0, src.core.l_qseq)             # <<<<<<<<<<<<<<
@@ -23335,17 +21868,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qual___get__(struct _
  *         def __set__(self,qual):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = __pyx_f_5pysam_9csamtools_get_qual_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_r = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_t_2 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("csamtools.AlignedRead.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -23354,18 +21887,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qual___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4qual_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_4qual_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qual));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2395
+/* "csamtools.pyx":2395
  *             return get_qual_range(src, 0, src.core.l_qseq)
  * 
  *         def __set__(self,qual):             # <<<<<<<<<<<<<<
@@ -23373,7 +21895,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4qual_3__set__(PyObject *__p
  *             cdef bam1_t * src
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_5pysam_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;
@@ -23381,35 +21904,33 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_
   int __pyx_v_l;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_2;
+  Py_ssize_t __pyx_t_3;
+  int __pyx_t_4;
   int __pyx_t_5;
-  int __pyx_t_6;
-  char *__pyx_t_7;
+  char *__pyx_t_6;
+  PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
-  PyObject *__pyx_t_9 = NULL;
-  int __pyx_t_10;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2402
+  /* "csamtools.pyx":2402
  *             cdef int k
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             p = bam1_qual( src )
  *             if qual == None or len(qual) == 0:
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2403
+  /* "csamtools.pyx":2403
  * 
  *             src = self._delegate
  *             p = bam1_qual( src )             # <<<<<<<<<<<<<<
@@ -23418,26 +21939,27 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_
  */
   __pyx_v_p = bam1_qual(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2404
+  /* "csamtools.pyx":2404
  *             src = self._delegate
  *             p = bam1_qual( src )
  *             if qual == None or len(qual) == 0:             # <<<<<<<<<<<<<<
  *                 # if absent - set to 0xff
  *                 p[0] = 0xff
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_qual, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __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 = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (!__pyx_t_3) {
-    __pyx_t_4 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = (__pyx_t_4 == 0);
-    __pyx_t_6 = __pyx_t_5;
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (!__pyx_t_2) {
+    __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = (__pyx_t_3 == 0);
+    __pyx_t_5 = __pyx_t_4;
   } else {
-    __pyx_t_6 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_2;
   }
-  if (__pyx_t_6) {
+  if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2406
+    /* "csamtools.pyx":2406
  *             if qual == None or len(qual) == 0:
  *                 # if absent - set to 0xff
  *                 p[0] = 0xff             # <<<<<<<<<<<<<<
@@ -23446,7 +21968,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_
  */
     (__pyx_v_p[0]) = 0xff;
 
-    /* "pysam/csamtools.pyx":2407
+    /* "csamtools.pyx":2407
  *                 # if absent - set to 0xff
  *                 p[0] = 0xff
  *                 return             # <<<<<<<<<<<<<<
@@ -23455,91 +21977,91 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_
  */
     __pyx_r = 0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2408
+  /* "csamtools.pyx":2408
  *                 p[0] = 0xff
  *                 return
  *             qual = _force_bytes(qual)             # <<<<<<<<<<<<<<
  *             cdef int l
  *             # convert to C string
  */
-  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_bytes(__pyx_v_qual)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_qual)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_v_qual);
-  __pyx_v_qual = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_v_qual = __pyx_t_1;
+  __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":2411
+  /* "csamtools.pyx":2411
  *             cdef int l
  *             # convert to C string
  *             q = qual             # <<<<<<<<<<<<<<
  *             l = len(qual)
  *             if src.core.l_qseq != l:
  */
-  __pyx_t_7 = PyBytes_AsString(__pyx_v_qual); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_q = __pyx_t_7;
+  __pyx_t_6 = PyBytes_AsString(__pyx_v_qual); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_q = __pyx_t_6;
 
-  /* "pysam/csamtools.pyx":2412
+  /* "csamtools.pyx":2412
  *             # convert to C string
  *             q = qual
  *             l = len(qual)             # <<<<<<<<<<<<<<
  *             if src.core.l_qseq != l:
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
  */
-  __pyx_t_4 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_l = __pyx_t_4;
+  __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_l = __pyx_t_3;
 
-  /* "pysam/csamtools.pyx":2413
+  /* "csamtools.pyx":2413
  *             q = qual
  *             l = len(qual)
  *             if src.core.l_qseq != l:             # <<<<<<<<<<<<<<
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
  *             assert src.core.l_qseq == l
  */
-  __pyx_t_6 = (__pyx_v_src->core.l_qseq != __pyx_v_l);
-  if (__pyx_t_6) {
+  __pyx_t_5 = (__pyx_v_src->core.l_qseq != __pyx_v_l);
+  if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2414
+    /* "csamtools.pyx":2414
  *             l = len(qual)
  *             if src.core.l_qseq != l:
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))             # <<<<<<<<<<<<<<
  *             assert src.core.l_qseq == l
  *             for k from 0 <= k < l:
  */
-    __pyx_t_2 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_8 = __Pyx_PyInt_to_py_int32_t(__pyx_v_src->core.l_qseq); 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_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__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_8);
-    __Pyx_GIVEREF(__pyx_t_8);
-    __pyx_t_2 = 0;
-    __pyx_t_8 = 0;
-    __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_136), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __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(((PyObject *)__pyx_t_8));
-    __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 = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-    __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); 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_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    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);
+    __Pyx_GIVEREF(__pyx_t_7);
+    __pyx_t_1 = 0;
+    __pyx_t_7 = 0;
+    __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_136), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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(((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;
+    __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); 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_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __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:;
 
-  /* "pysam/csamtools.pyx":2415
+  /* "csamtools.pyx":2415
  *             if src.core.l_qseq != l:
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
  *             assert src.core.l_qseq == l             # <<<<<<<<<<<<<<
@@ -23553,17 +22075,17 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_
   }
   #endif
 
-  /* "pysam/csamtools.pyx":2416
+  /* "csamtools.pyx":2416
  *                 raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
  *             assert src.core.l_qseq == l
  *             for k from 0 <= k < l:             # <<<<<<<<<<<<<<
  *                 p[k] = <uint8_t>q[k] - 33
  * 
  */
-  __pyx_t_10 = __pyx_v_l;
-  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_10; __pyx_v_k++) {
+  __pyx_t_9 = __pyx_v_l;
+  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_9; __pyx_v_k++) {
 
-    /* "pysam/csamtools.pyx":2417
+    /* "csamtools.pyx":2417
  *             assert src.core.l_qseq == l
  *             for k from 0 <= k < l:
  *                 p[k] = <uint8_t>q[k] - 33             # <<<<<<<<<<<<<<
@@ -23576,10 +22098,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.qual.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.qual.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_qual);
@@ -23588,18 +22110,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5query_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5query_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_5query___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2431
+/* "csamtools.pyx":2431
  *         were not considered for alignment may have been retained."""
  * 
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -23607,71 +22118,70 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5query_1__get__(PyObje
  *             cdef uint32_t start, end
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5query___get__(struct __pyx_obj_5pysam_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;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  int32_t __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_1;
+  int32_t __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2436
+  /* "csamtools.pyx":2436
  *             cdef char * s
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  * 
  *             if src.core.l_qseq == 0: return None
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2438
+  /* "csamtools.pyx":2438
  *             src = self._delegate
  * 
  *             if src.core.l_qseq == 0: return None             # <<<<<<<<<<<<<<
  * 
  *             start = query_start(src)
  */
-  __pyx_t_2 = (__pyx_v_src->core.l_qseq == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2440
+  /* "csamtools.pyx":2440
  *             if src.core.l_qseq == 0: return None
  * 
  *             start = query_start(src)             # <<<<<<<<<<<<<<
  *             end   = query_end(src)
  * 
  */
-  __pyx_t_3 = __pyx_f_5pysam_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_start = __pyx_t_3;
+  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_start = __pyx_t_2;
 
-  /* "pysam/csamtools.pyx":2441
+  /* "csamtools.pyx":2441
  * 
  *             start = query_start(src)
  *             end   = query_end(src)             # <<<<<<<<<<<<<<
  * 
  *             return get_seq_range(src, start, end)
  */
-  __pyx_t_3 = __pyx_f_5pysam_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_end = __pyx_t_3;
+  __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_end = __pyx_t_2;
 
-  /* "pysam/csamtools.pyx":2443
+  /* "csamtools.pyx":2443
  *             end   = query_end(src)
  * 
  *             return get_seq_range(src, start, end)             # <<<<<<<<<<<<<<
@@ -23679,17 +22189,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5query___get__(struct
  *     property qqual:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_4 = __pyx_f_5pysam_9csamtools_get_seq_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_r = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_t_3 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_r = __pyx_t_3;
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.query.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("csamtools.AlignedRead.query.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -23698,18 +22208,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5query___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5qqual_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5qqual_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_5qqual___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2449
+/* "csamtools.pyx":2449
  * 
  *         In Python 3, this property is of type bytes."""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -23717,71 +22216,70 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5qqual_1__get__(PyObje
  *             cdef uint32_t start, end
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_obj_5pysam_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;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  int32_t __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_1;
+  int32_t __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2453
+  /* "csamtools.pyx":2453
  *             cdef uint32_t start, end
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  * 
  *             if src.core.l_qseq == 0: return None
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2455
+  /* "csamtools.pyx":2455
  *             src = self._delegate
  * 
  *             if src.core.l_qseq == 0: return None             # <<<<<<<<<<<<<<
  * 
  *             start = query_start(src)
  */
-  __pyx_t_2 = (__pyx_v_src->core.l_qseq == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2457
+  /* "csamtools.pyx":2457
  *             if src.core.l_qseq == 0: return None
  * 
  *             start = query_start(src)             # <<<<<<<<<<<<<<
  *             end   = query_end(src)
  * 
  */
-  __pyx_t_3 = __pyx_f_5pysam_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_start = __pyx_t_3;
+  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_start = __pyx_t_2;
 
-  /* "pysam/csamtools.pyx":2458
+  /* "csamtools.pyx":2458
  * 
  *             start = query_start(src)
  *             end   = query_end(src)             # <<<<<<<<<<<<<<
  * 
  *             return get_qual_range(src, start, end)
  */
-  __pyx_t_3 = __pyx_f_5pysam_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_end = __pyx_t_3;
+  __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_end = __pyx_t_2;
 
-  /* "pysam/csamtools.pyx":2460
+  /* "csamtools.pyx":2460
  *             end   = query_end(src)
  * 
  *             return get_qual_range(src, start, end)             # <<<<<<<<<<<<<<
@@ -23789,17 +22287,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5qqual___get__(struct
  *     property qstart:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_4 = __pyx_f_5pysam_9csamtools_get_qual_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_r = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_t_3 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_r = __pyx_t_3;
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.qqual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("csamtools.AlignedRead.qqual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -23808,18 +22306,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5qqual___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_6qstart_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_6qstart_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_6qstart___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2464
+/* "csamtools.pyx":2464
  *     property qstart:
  *         """start index of the aligned query portion of the sequence (0-based, inclusive)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -23827,7 +22314,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_6qstart_1__get__(PyObj
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_obj_5pysam_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;
@@ -23836,10 +22324,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6qstart___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], 2464);
 
-  /* "pysam/csamtools.pyx":2465
+  /* "csamtools.pyx":2465
  *         """start index of the aligned query portion of the sequence (0-based, inclusive)"""
  *         def __get__(self):
  *             return query_start(self._delegate)             # <<<<<<<<<<<<<<
@@ -23847,7 +22335,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6qstart___get__(struct
  *     property qend:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_5pysam_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;
@@ -23858,7 +22346,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6qstart___get__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.qstart.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.qstart.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -23867,18 +22355,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_6qstart___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qend_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qend_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4qend___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2469
+/* "csamtools.pyx":2469
  *     property qend:
  *         """end index of the aligned query portion of the sequence (0-based, exclusive)"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -23886,7 +22363,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qend_1__get__(PyObjec
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qend___get__(struct __pyx_obj_5pysam_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;
@@ -23895,10 +22373,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qend___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], 2469);
 
-  /* "pysam/csamtools.pyx":2470
+  /* "csamtools.pyx":2470
  *         """end index of the aligned query portion of the sequence (0-based, exclusive)"""
  *         def __get__(self):
  *             return query_end(self._delegate)             # <<<<<<<<<<<<<<
@@ -23906,7 +22384,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qend___get__(struct _
  *     property qlen:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_5pysam_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;
@@ -23917,7 +22395,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qend___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.qend.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.qend.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -23926,18 +22404,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qend___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qlen_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qlen_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4qlen___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2474
+/* "csamtools.pyx":2474
  *     property qlen:
  *         """Length of the aligned query sequence"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -23945,32 +22412,31 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4qlen_1__get__(PyObjec
  *             src = self._delegate
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_obj_5pysam_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
-  bam1_t *__pyx_t_1;
+  int32_t __pyx_t_1;
   int32_t __pyx_t_2;
-  int32_t __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_3 = NULL;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2476
+  /* "csamtools.pyx":2476
  *         def __get__(self):
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             return query_end(src)-query_start(src)
  * 
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2477
+  /* "csamtools.pyx":2477
  *             cdef bam1_t * src
  *             src = self._delegate
  *             return query_end(src)-query_start(src)             # <<<<<<<<<<<<<<
@@ -23978,19 +22444,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qlen___get__(struct _
  *     property tags:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = __pyx_f_5pysam_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __pyx_f_5pysam_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = PyInt_FromLong((__pyx_t_2 - __pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_r = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_t_1 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromLong((__pyx_t_1 - __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_r = __pyx_t_3;
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.qlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("csamtools.AlignedRead.qlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -23999,18 +22465,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4qlen___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4tags_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4tags_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2494
+/* "csamtools.pyx":2494
  *         multiple times.
  *         """
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -24018,7 +22473,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4tags_1__get__(PyObjec
  *             cdef bam1_t * src
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct __pyx_obj_5pysam_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];
@@ -24029,58 +22485,56 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
   PyObject *__pyx_v_value = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  char __pyx_t_4;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  char __pyx_t_3;
+  int __pyx_t_4;
   int __pyx_t_5;
-  int __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  Py_ssize_t __pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   PyObject *__pyx_t_9 = NULL;
   PyObject *__pyx_t_10 = NULL;
-  PyObject *__pyx_t_11 = NULL;
-  PyObject *(*__pyx_t_12)(PyObject *);
-  uint8_t __pyx_t_13;
-  int32_t __pyx_t_14;
-  int __pyx_t_15;
+  PyObject *(*__pyx_t_11)(PyObject *);
+  uint8_t __pyx_t_12;
+  int32_t __pyx_t_13;
+  int __pyx_t_14;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2503
+  /* "csamtools.pyx":2503
  *             cdef int32_t nvalues
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             if src.l_aux == 0: return []
  *             s = bam1_aux( src )
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2504
+  /* "csamtools.pyx":2504
  * 
  *             src = self._delegate
  *             if src.l_aux == 0: return []             # <<<<<<<<<<<<<<
  *             s = bam1_aux( src )
  *             result = []
  */
-  __pyx_t_2 = (__pyx_v_src->l_aux == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->l_aux == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_r = ((PyObject *)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __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(((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:;
 
-  /* "pysam/csamtools.pyx":2505
+  /* "csamtools.pyx":2505
  *             src = self._delegate
  *             if src.l_aux == 0: return []
  *             s = bam1_aux( src )             # <<<<<<<<<<<<<<
@@ -24089,19 +22543,19 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  */
   __pyx_v_s = bam1_aux(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2506
+  /* "csamtools.pyx":2506
  *             if src.l_aux == 0: return []
  *             s = bam1_aux( src )
  *             result = []             # <<<<<<<<<<<<<<
  *             auxtag[2] = 0
  *             while s < (src.data + src.data_len):
  */
-  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_v_result = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __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(((PyObject *)__pyx_t_2));
+  __pyx_v_result = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":2507
+  /* "csamtools.pyx":2507
  *             s = bam1_aux( src )
  *             result = []
  *             auxtag[2] = 0             # <<<<<<<<<<<<<<
@@ -24110,7 +22564,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  */
   (__pyx_v_auxtag[2]) = 0;
 
-  /* "pysam/csamtools.pyx":2508
+  /* "csamtools.pyx":2508
  *             result = []
  *             auxtag[2] = 0
  *             while s < (src.data + src.data_len):             # <<<<<<<<<<<<<<
@@ -24118,10 +22572,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  *                 auxtag[0] = s[0]
  */
   while (1) {
-    __pyx_t_2 = (__pyx_v_s < (__pyx_v_src->data + __pyx_v_src->data_len));
-    if (!__pyx_t_2) break;
+    __pyx_t_1 = (__pyx_v_s < (__pyx_v_src->data + __pyx_v_src->data_len));
+    if (!__pyx_t_1) break;
 
-    /* "pysam/csamtools.pyx":2510
+    /* "csamtools.pyx":2510
  *             while s < (src.data + src.data_len):
  *                 # get tag
  *                 auxtag[0] = s[0]             # <<<<<<<<<<<<<<
@@ -24130,7 +22584,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  */
     (__pyx_v_auxtag[0]) = (__pyx_v_s[0]);
 
-    /* "pysam/csamtools.pyx":2511
+    /* "csamtools.pyx":2511
  *                 # get tag
  *                 auxtag[0] = s[0]
  *                 auxtag[1] = s[1]             # <<<<<<<<<<<<<<
@@ -24139,7 +22593,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  */
     (__pyx_v_auxtag[1]) = (__pyx_v_s[1]);
 
-    /* "pysam/csamtools.pyx":2512
+    /* "csamtools.pyx":2512
  *                 auxtag[0] = s[0]
  *                 auxtag[1] = s[1]
  *                 s += 2             # <<<<<<<<<<<<<<
@@ -24148,7 +22602,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  */
     __pyx_v_s = (__pyx_v_s + 2);
 
-    /* "pysam/csamtools.pyx":2513
+    /* "csamtools.pyx":2513
  *                 auxtag[1] = s[1]
  *                 s += 2
  *                 auxtype = s[0]             # <<<<<<<<<<<<<<
@@ -24157,38 +22611,38 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  */
     __pyx_v_auxtype = (__pyx_v_s[0]);
 
-    /* "pysam/csamtools.pyx":2514
+    /* "csamtools.pyx":2514
  *                 s += 2
  *                 auxtype = s[0]
  *                 if auxtype in ('c', 'C'):             # <<<<<<<<<<<<<<
  *                     value = <int>bam_aux2i(s)
  *                     s += 1
  */
-    __pyx_t_4 = __pyx_v_auxtype;
-    __pyx_t_2 = ((int)(__pyx_t_4 == 'c'));
-    if (!__pyx_t_2) {
-      __pyx_t_5 = ((int)(__pyx_t_4 == 'C'));
-      __pyx_t_6 = __pyx_t_5;
+    __pyx_t_3 = __pyx_v_auxtype;
+    __pyx_t_1 = ((int)(__pyx_t_3 == 'c'));
+    if (!__pyx_t_1) {
+      __pyx_t_4 = ((int)(__pyx_t_3 == 'C'));
+      __pyx_t_5 = __pyx_t_4;
     } else {
-      __pyx_t_6 = __pyx_t_2;
+      __pyx_t_5 = __pyx_t_1;
     }
-    __pyx_t_2 = __pyx_t_6;
-    if (__pyx_t_2) {
+    __pyx_t_1 = __pyx_t_5;
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2515
+      /* "csamtools.pyx":2515
  *                 auxtype = s[0]
  *                 if auxtype in ('c', 'C'):
  *                     value = <int>bam_aux2i(s)             # <<<<<<<<<<<<<<
  *                     s += 1
  *                 elif auxtype in ('s', 'S'):
  */
-      __pyx_t_3 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_value = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":2516
+      /* "csamtools.pyx":2516
  *                 if auxtype in ('c', 'C'):
  *                     value = <int>bam_aux2i(s)
  *                     s += 1             # <<<<<<<<<<<<<<
@@ -24196,41 +22650,41 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  *                     value = <int>bam_aux2i(s)
  */
       __pyx_v_s = (__pyx_v_s + 1);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
-    /* "pysam/csamtools.pyx":2517
+    /* "csamtools.pyx":2517
  *                     value = <int>bam_aux2i(s)
  *                     s += 1
  *                 elif auxtype in ('s', 'S'):             # <<<<<<<<<<<<<<
  *                     value = <int>bam_aux2i(s)
  *                     s += 2
  */
-    __pyx_t_4 = __pyx_v_auxtype;
-    __pyx_t_2 = ((int)(__pyx_t_4 == 's'));
-    if (!__pyx_t_2) {
-      __pyx_t_6 = ((int)(__pyx_t_4 == 'S'));
-      __pyx_t_5 = __pyx_t_6;
+    __pyx_t_3 = __pyx_v_auxtype;
+    __pyx_t_1 = ((int)(__pyx_t_3 == 's'));
+    if (!__pyx_t_1) {
+      __pyx_t_5 = ((int)(__pyx_t_3 == 'S'));
+      __pyx_t_4 = __pyx_t_5;
     } else {
-      __pyx_t_5 = __pyx_t_2;
+      __pyx_t_4 = __pyx_t_1;
     }
-    __pyx_t_2 = __pyx_t_5;
-    if (__pyx_t_2) {
+    __pyx_t_1 = __pyx_t_4;
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2518
+      /* "csamtools.pyx":2518
  *                     s += 1
  *                 elif auxtype in ('s', 'S'):
  *                     value = <int>bam_aux2i(s)             # <<<<<<<<<<<<<<
  *                     s += 2
  *                 elif auxtype in ('i', 'I'):
  */
-      __pyx_t_3 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_value = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":2519
+      /* "csamtools.pyx":2519
  *                 elif auxtype in ('s', 'S'):
  *                     value = <int>bam_aux2i(s)
  *                     s += 2             # <<<<<<<<<<<<<<
@@ -24238,41 +22692,41 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  *                     value = <int32_t>bam_aux2i(s)
  */
       __pyx_v_s = (__pyx_v_s + 2);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
-    /* "pysam/csamtools.pyx":2520
+    /* "csamtools.pyx":2520
  *                     value = <int>bam_aux2i(s)
  *                     s += 2
  *                 elif auxtype in ('i', 'I'):             # <<<<<<<<<<<<<<
  *                     value = <int32_t>bam_aux2i(s)
  *                     s += 4
  */
-    __pyx_t_4 = __pyx_v_auxtype;
-    __pyx_t_2 = ((int)(__pyx_t_4 == 'i'));
-    if (!__pyx_t_2) {
-      __pyx_t_5 = ((int)(__pyx_t_4 == 'I'));
-      __pyx_t_6 = __pyx_t_5;
+    __pyx_t_3 = __pyx_v_auxtype;
+    __pyx_t_1 = ((int)(__pyx_t_3 == 'i'));
+    if (!__pyx_t_1) {
+      __pyx_t_4 = ((int)(__pyx_t_3 == 'I'));
+      __pyx_t_5 = __pyx_t_4;
     } else {
-      __pyx_t_6 = __pyx_t_2;
+      __pyx_t_5 = __pyx_t_1;
     }
-    __pyx_t_2 = __pyx_t_6;
-    if (__pyx_t_2) {
+    __pyx_t_1 = __pyx_t_5;
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2521
+      /* "csamtools.pyx":2521
  *                     s += 2
  *                 elif auxtype in ('i', 'I'):
  *                     value = <int32_t>bam_aux2i(s)             # <<<<<<<<<<<<<<
  *                     s += 4
  *                 elif auxtype == 'f':
  */
-      __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(((int32_t)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((int32_t)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_value = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":2522
+      /* "csamtools.pyx":2522
  *                 elif auxtype in ('i', 'I'):
  *                     value = <int32_t>bam_aux2i(s)
  *                     s += 4             # <<<<<<<<<<<<<<
@@ -24280,33 +22734,33 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  *                     value = <float>bam_aux2f(s)
  */
       __pyx_v_s = (__pyx_v_s + 4);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
-    /* "pysam/csamtools.pyx":2523
+    /* "csamtools.pyx":2523
  *                     value = <int32_t>bam_aux2i(s)
  *                     s += 4
  *                 elif auxtype == 'f':             # <<<<<<<<<<<<<<
  *                     value = <float>bam_aux2f(s)
  *                     s += 4
  */
-    __pyx_t_2 = (__pyx_v_auxtype == 'f');
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_v_auxtype == 'f');
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2524
+      /* "csamtools.pyx":2524
  *                     s += 4
  *                 elif auxtype == 'f':
  *                     value = <float>bam_aux2f(s)             # <<<<<<<<<<<<<<
  *                     s += 4
  *                 elif auxtype == 'd':
  */
-      __pyx_t_3 = PyFloat_FromDouble(((float)bam_aux2f(__pyx_v_s))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyFloat_FromDouble(((float)bam_aux2f(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_value = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":2525
+      /* "csamtools.pyx":2525
  *                 elif auxtype == 'f':
  *                     value = <float>bam_aux2f(s)
  *                     s += 4             # <<<<<<<<<<<<<<
@@ -24314,33 +22768,33 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  *                     value = <double>bam_aux2d(s)
  */
       __pyx_v_s = (__pyx_v_s + 4);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
-    /* "pysam/csamtools.pyx":2526
+    /* "csamtools.pyx":2526
  *                     value = <float>bam_aux2f(s)
  *                     s += 4
  *                 elif auxtype == 'd':             # <<<<<<<<<<<<<<
  *                     value = <double>bam_aux2d(s)
  *                     s += 8
  */
-    __pyx_t_2 = (__pyx_v_auxtype == 'd');
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_v_auxtype == 'd');
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2527
+      /* "csamtools.pyx":2527
  *                     s += 4
  *                 elif auxtype == 'd':
  *                     value = <double>bam_aux2d(s)             # <<<<<<<<<<<<<<
  *                     s += 8
  *                 elif auxtype == 'A':
  */
-      __pyx_t_3 = PyFloat_FromDouble(((double)bam_aux2d(__pyx_v_s))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_2 = PyFloat_FromDouble(((double)bam_aux2d(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_3;
-      __pyx_t_3 = 0;
+      __pyx_v_value = __pyx_t_2;
+      __pyx_t_2 = 0;
 
-      /* "pysam/csamtools.pyx":2528
+      /* "csamtools.pyx":2528
  *                 elif auxtype == 'd':
  *                     value = <double>bam_aux2d(s)
  *                     s += 8             # <<<<<<<<<<<<<<
@@ -24348,36 +22802,36 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  *                     value = "%c" % <char>bam_aux2A(s)
  */
       __pyx_v_s = (__pyx_v_s + 8);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
-    /* "pysam/csamtools.pyx":2529
+    /* "csamtools.pyx":2529
  *                     value = <double>bam_aux2d(s)
  *                     s += 8
  *                 elif auxtype == 'A':             # <<<<<<<<<<<<<<
  *                     value = "%c" % <char>bam_aux2A(s)
  *                     s += 1
  */
-    __pyx_t_2 = (__pyx_v_auxtype == 'A');
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_v_auxtype == 'A');
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2530
+      /* "csamtools.pyx":2530
  *                     s += 8
  *                 elif auxtype == 'A':
  *                     value = "%c" % <char>bam_aux2A(s)             # <<<<<<<<<<<<<<
  *                     s += 1
  *                 elif auxtype in ('Z', 'H'):
  */
-      __pyx_t_3 = PyInt_FromLong(((char)bam_aux2A(__pyx_v_s))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_137), __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_2 = PyInt_FromLong(((char)bam_aux2A(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_137), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = ((PyObject *)__pyx_t_7);
-      __pyx_t_7 = 0;
+      __pyx_v_value = ((PyObject *)__pyx_t_6);
+      __pyx_t_6 = 0;
 
-      /* "pysam/csamtools.pyx":2531
+      /* "csamtools.pyx":2531
  *                 elif auxtype == 'A':
  *                     value = "%c" % <char>bam_aux2A(s)
  *                     s += 1             # <<<<<<<<<<<<<<
@@ -24385,63 +22839,63 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  *                     value = _charptr_to_str(<char*>bam_aux2Z(s))
  */
       __pyx_v_s = (__pyx_v_s + 1);
-      goto __pyx_L6;
+      goto __pyx_L8;
     }
 
-    /* "pysam/csamtools.pyx":2532
+    /* "csamtools.pyx":2532
  *                     value = "%c" % <char>bam_aux2A(s)
  *                     s += 1
  *                 elif auxtype in ('Z', 'H'):             # <<<<<<<<<<<<<<
  *                     value = _charptr_to_str(<char*>bam_aux2Z(s))
  *                     # +1 for NULL terminated string
  */
-    __pyx_t_4 = __pyx_v_auxtype;
-    __pyx_t_2 = ((int)(__pyx_t_4 == 'Z'));
-    if (!__pyx_t_2) {
-      __pyx_t_6 = ((int)(__pyx_t_4 == 'H'));
-      __pyx_t_5 = __pyx_t_6;
+    __pyx_t_3 = __pyx_v_auxtype;
+    __pyx_t_1 = ((int)(__pyx_t_3 == 'Z'));
+    if (!__pyx_t_1) {
+      __pyx_t_5 = ((int)(__pyx_t_3 == 'H'));
+      __pyx_t_4 = __pyx_t_5;
     } else {
-      __pyx_t_5 = __pyx_t_2;
+      __pyx_t_4 = __pyx_t_1;
     }
-    __pyx_t_2 = __pyx_t_5;
-    if (__pyx_t_2) {
+    __pyx_t_1 = __pyx_t_4;
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2533
+      /* "csamtools.pyx":2533
  *                     s += 1
  *                 elif auxtype in ('Z', 'H'):
  *                     value = _charptr_to_str(<char*>bam_aux2Z(s))             # <<<<<<<<<<<<<<
  *                     # +1 for NULL terminated string
  *                     s += len(value) + 1
  */
-      __pyx_t_7 = __pyx_f_5pysam_9csamtools__charptr_to_str(((char *)bam_aux2Z(__pyx_v_s))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_6 = __pyx_f_9csamtools__charptr_to_str(((char *)bam_aux2Z(__pyx_v_s))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_7;
-      __pyx_t_7 = 0;
+      __pyx_v_value = __pyx_t_6;
+      __pyx_t_6 = 0;
 
-      /* "pysam/csamtools.pyx":2535
+      /* "csamtools.pyx":2535
  *                     value = _charptr_to_str(<char*>bam_aux2Z(s))
  *                     # +1 for NULL terminated string
  *                     s += len(value) + 1             # <<<<<<<<<<<<<<
  *                 elif auxtype == 'B':
  *                     s += 1
  */
-      __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_s = (__pyx_v_s + (__pyx_t_8 + 1));
-      goto __pyx_L6;
+      __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_L8;
     }
 
-    /* "pysam/csamtools.pyx":2536
+    /* "csamtools.pyx":2536
  *                     # +1 for NULL terminated string
  *                     s += len(value) + 1
  *                 elif auxtype == 'B':             # <<<<<<<<<<<<<<
  *                     s += 1
  *                     byte_size, nvalues, value = convertBinaryTagToList( s )
  */
-    __pyx_t_2 = (__pyx_v_auxtype == 'B');
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_v_auxtype == 'B');
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2537
+      /* "csamtools.pyx":2537
  *                     s += len(value) + 1
  *                 elif auxtype == 'B':
  *                     s += 1             # <<<<<<<<<<<<<<
@@ -24450,81 +22904,73 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  */
       __pyx_v_s = (__pyx_v_s + 1);
 
-      /* "pysam/csamtools.pyx":2538
+      /* "csamtools.pyx":2538
  *                 elif auxtype == 'B':
  *                     s += 1
  *                     byte_size, nvalues, value = convertBinaryTagToList( s )             # <<<<<<<<<<<<<<
  *                     # 5 for 1 char and 1 int
  *                     s += 5 + ( nvalues * byte_size) - 1
  */
-      __pyx_t_7 = __pyx_f_5pysam_9csamtools_convertBinaryTagToList(__pyx_v_s); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
-        PyObject* sequence = __pyx_t_7;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        Py_ssize_t size = Py_SIZE(sequence);
-        #else
-        Py_ssize_t size = PySequence_Size(sequence);
-        #endif
-        if (unlikely(size != 3)) {
-          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
-          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_6 = __pyx_f_9csamtools_convertBinaryTagToList(__pyx_v_s); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
+        PyObject* sequence = __pyx_t_6;
         if (likely(PyTuple_CheckExact(sequence))) {
-          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
-          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); 
+          if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
+            if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
+            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
+          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
+          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
         } else {
-          __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
-          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
-          __pyx_t_10 = PyList_GET_ITEM(sequence, 2); 
+          if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
+            if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
+            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
+          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
+          __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
         }
-        __Pyx_INCREF(__pyx_t_3);
+        __Pyx_INCREF(__pyx_t_2);
+        __Pyx_INCREF(__pyx_t_8);
         __Pyx_INCREF(__pyx_t_9);
-        __Pyx_INCREF(__pyx_t_10);
-        #else
-        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      } else
-      {
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      } else {
         Py_ssize_t index = -1;
-        __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_11);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
-        index = 0; __pyx_t_3 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
-        __Pyx_GOTREF(__pyx_t_3);
-        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_L7_unpacking_failed;
+        __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_12 = NULL;
-        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-        goto __pyx_L8_unpacking_done;
-        __pyx_L7_unpacking_failed:;
-        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-        __pyx_t_12 = NULL;
-        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+        __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_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_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_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_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_13 = __Pyx_PyInt_from_py_uint8_t(__pyx_t_3); if (unlikely((__pyx_t_13 == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_byte_size = __pyx_t_13;
-      __pyx_v_nvalues = __pyx_t_14;
+      __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;
+      __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_8); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_v_byte_size = __pyx_t_12;
+      __pyx_v_nvalues = __pyx_t_13;
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_10;
-      __pyx_t_10 = 0;
+      __pyx_v_value = __pyx_t_9;
+      __pyx_t_9 = 0;
 
-      /* "pysam/csamtools.pyx":2540
+      /* "csamtools.pyx":2540
  *                     byte_size, nvalues, value = convertBinaryTagToList( s )
  *                     # 5 for 1 char and 1 int
  *                     s += 5 + ( nvalues * byte_size) - 1             # <<<<<<<<<<<<<<
@@ -24532,11 +22978,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  *                 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:;
 
-    /* "pysam/csamtools.pyx":2542
+    /* "csamtools.pyx":2542
  *                     s += 5 + ( nvalues * byte_size) - 1
  * 
  *                 s += 1             # <<<<<<<<<<<<<<
@@ -24545,29 +22991,31 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
  */
     __pyx_v_s = (__pyx_v_s + 1);
 
-    /* "pysam/csamtools.pyx":2544
+    /* "csamtools.pyx":2544
  *                 s += 1
  * 
  *                 result.append( (_charptr_to_str(auxtag), value) )             # <<<<<<<<<<<<<<
  * 
  *             return result
  */
-    __pyx_t_7 = __pyx_f_5pysam_9csamtools__charptr_to_str(__pyx_v_auxtag); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    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_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
-    __Pyx_GIVEREF(__pyx_t_7);
+    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(((PyObject *)__pyx_t_9));
+    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_v_value);
-    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_value);
+    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_7 = 0;
-    __pyx_t_15 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_10)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_14 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
   }
 
-  /* "pysam/csamtools.pyx":2546
+  /* "csamtools.pyx":2546
  *                 result.append( (_charptr_to_str(auxtag), value) )
  * 
  *             return result             # <<<<<<<<<<<<<<
@@ -24582,12 +23030,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.tags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.tags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_result);
@@ -24598,18 +23046,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tags___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4tags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_4tags_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tags));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2548
+/* "csamtools.pyx":2548
  *             return result
  * 
  *         def __set__(self, tags):             # <<<<<<<<<<<<<<
@@ -24617,7 +23054,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4tags_3__set__(PyObject *__p
  *             cdef uint8_t * s
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_5pysam_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;
@@ -24637,74 +23075,73 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_
   PyObject *__pyx_v_buffer = NULL;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
+  PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
-  PyObject *(*__pyx_t_6)(PyObject *);
+  int __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_6 = NULL;
   PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
-  PyObject *__pyx_t_9 = NULL;
-  PyObject *(*__pyx_t_10)(PyObject *);
+  PyObject *(*__pyx_t_9)(PyObject *);
+  int __pyx_t_10;
   int __pyx_t_11;
-  int __pyx_t_12;
-  Py_ssize_t __pyx_t_13;
+  Py_ssize_t __pyx_t_12;
+  PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
-  PyObject *__pyx_t_15 = NULL;
-  int __pyx_t_16;
-  size_t __pyx_t_17;
-  int __pyx_t_18;
-  char *__pyx_t_19;
+  int __pyx_t_15;
+  size_t __pyx_t_16;
+  int __pyx_t_17;
+  char *__pyx_t_18;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2554
+  /* "csamtools.pyx":2554
  *             cdef char * temp
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  * 
  *             fmts, args = ["<"], []
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2556
+  /* "csamtools.pyx":2556
  *             src = self._delegate
  * 
  *             fmts, args = ["<"], []             # <<<<<<<<<<<<<<
  * 
  *             if tags != None:
  */
-  __pyx_t_2 = PyList_New(1); 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_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(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_kp_s_138));
-  PyList_SET_ITEM(__pyx_t_2, 0, ((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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_v_fmts = __pyx_t_2;
+  __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(((PyObject *)__pyx_t_2));
+  __pyx_v_fmts = __pyx_t_1;
+  __pyx_t_1 = 0;
+  __pyx_v_args = __pyx_t_2;
   __pyx_t_2 = 0;
-  __pyx_v_args = __pyx_t_3;
-  __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":2558
+  /* "csamtools.pyx":2558
  *             fmts, args = ["<"], []
  * 
  *             if tags != None:             # <<<<<<<<<<<<<<
  * 
  *                 # map samtools code to python.struct code and byte size
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_tags, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2558; __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 = 2558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_4) {
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_tags, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":2561
+    /* "csamtools.pyx":2561
  * 
  *                 # map samtools code to python.struct code and byte size
  *                 for pytag, value in tags:             # <<<<<<<<<<<<<<
@@ -24712,126 +23149,111 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_
  *                         pytag = pytag.encode('ascii')
  */
     if (PyList_CheckExact(__pyx_v_tags) || PyTuple_CheckExact(__pyx_v_tags)) {
-      __pyx_t_3 = __pyx_v_tags; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
-      __pyx_t_6 = NULL;
+      __pyx_t_2 = __pyx_v_tags; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+      __pyx_t_5 = NULL;
     } else {
-      __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_tags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_tags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+      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 (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 {
-        __pyx_t_2 = __pyx_t_6(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_1 = __pyx_t_5(__pyx_t_2);
+        if (unlikely(!__pyx_t_1)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_1);
       }
-      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
-        PyObject* sequence = __pyx_t_2;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        Py_ssize_t size = Py_SIZE(sequence);
-        #else
-        Py_ssize_t size = PySequence_Size(sequence);
-        #endif
-        if (unlikely(size != 2)) {
-          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        #if CYTHON_COMPILING_IN_CPYTHON
+      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+        PyObject* sequence = __pyx_t_1;
         if (likely(PyTuple_CheckExact(sequence))) {
-          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
-          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
+          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
+          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
         } else {
-          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
-          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
+          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
+          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
         }
+        __Pyx_INCREF(__pyx_t_6);
         __Pyx_INCREF(__pyx_t_7);
-        __Pyx_INCREF(__pyx_t_8);
-        #else
-        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      } else
-      {
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      } else {
         Py_ssize_t index = -1;
-        __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
-        index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
-        __Pyx_GOTREF(__pyx_t_7);
-        index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
+        __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_10 = NULL;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        goto __pyx_L7_unpacking_done;
-        __pyx_L6_unpacking_failed:;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_10 = NULL;
-        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+        __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_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_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_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_7;
-      __pyx_t_7 = 0;
+      __pyx_v_pytag = __pyx_t_6;
+      __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_v_value);
-      __pyx_v_value = __pyx_t_8;
-      __pyx_t_8 = 0;
+      __pyx_v_value = __pyx_t_7;
+      __pyx_t_7 = 0;
 
-      /* "pysam/csamtools.pyx":2562
+      /* "csamtools.pyx":2562
  *                 # map samtools code to python.struct code and byte size
  *                 for pytag, value in tags:
  *                     if not type(pytag) is bytes:             # <<<<<<<<<<<<<<
  *                         pytag = pytag.encode('ascii')
  *                     t = type(value)
  */
-      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_pytag)) == ((PyObject *)((PyObject*)(&PyBytes_Type))));
-      __pyx_t_11 = (!__pyx_t_4);
-      if (__pyx_t_11) {
+      __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_pytag)) == ((PyObject *)((PyObject*)(&PyBytes_Type))));
+      __pyx_t_10 = (!__pyx_t_3);
+      if (__pyx_t_10) {
 
-        /* "pysam/csamtools.pyx":2563
+        /* "csamtools.pyx":2563
  *                 for pytag, value in tags:
  *                     if not type(pytag) is bytes:
  *                         pytag = pytag.encode('ascii')             # <<<<<<<<<<<<<<
  *                     t = type(value)
  * 
  */
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_pytag, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_139), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_1 = PyObject_GetAttr(__pyx_v_pytag, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_139), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_v_pytag);
-        __pyx_v_pytag = __pyx_t_8;
-        __pyx_t_8 = 0;
-        goto __pyx_L8;
+        __pyx_v_pytag = __pyx_t_7;
+        __pyx_t_7 = 0;
+        goto __pyx_L10;
       }
-      __pyx_L8:;
+      __pyx_L10:;
 
-      /* "pysam/csamtools.pyx":2564
+      /* "csamtools.pyx":2564
  *                     if not type(pytag) is bytes:
  *                         pytag = pytag.encode('ascii')
  *                     t = type(value)             # <<<<<<<<<<<<<<
@@ -24842,23 +23264,23 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_
       __Pyx_XDECREF(((PyObject *)__pyx_v_t));
       __pyx_v_t = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_value)));
 
-      /* "pysam/csamtools.pyx":2566
+      /* "csamtools.pyx":2566
  *                     t = type(value)
  * 
  *                     if t is tuple or t is list:             # <<<<<<<<<<<<<<
  *                         # binary tags - treat separately
  *                         pytype = 'B'
  */
-      __pyx_t_11 = (__pyx_v_t == ((PyObject*)(&PyTuple_Type)));
-      if (!__pyx_t_11) {
-        __pyx_t_4 = (__pyx_v_t == ((PyObject*)(&PyList_Type)));
-        __pyx_t_12 = __pyx_t_4;
+      __pyx_t_10 = (__pyx_v_t == ((PyObject*)(&PyTuple_Type)));
+      if (!__pyx_t_10) {
+        __pyx_t_3 = (__pyx_v_t == ((PyObject*)(&PyList_Type)));
+        __pyx_t_11 = __pyx_t_3;
       } else {
-        __pyx_t_12 = __pyx_t_11;
+        __pyx_t_11 = __pyx_t_10;
       }
-      if (__pyx_t_12) {
+      if (__pyx_t_11) {
 
-        /* "pysam/csamtools.pyx":2568
+        /* "csamtools.pyx":2568
  *                     if t is tuple or t is list:
  *                         # binary tags - treat separately
  *                         pytype = 'B'             # <<<<<<<<<<<<<<
@@ -24869,1021 +23291,1032 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_
         __Pyx_XDECREF(__pyx_v_pytype);
         __pyx_v_pytype = ((PyObject *)__pyx_n_s__B);
 
-        /* "pysam/csamtools.pyx":2570
+        /* "csamtools.pyx":2570
  *                         pytype = 'B'
  *                         # get data type - first value determines type
  *                         if type(value[0]) is float:             # <<<<<<<<<<<<<<
  *                             datafmt, datatype = "f", "f"
  *                         else:
  */
-        __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_value, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_12 = (((PyObject *)Py_TYPE(__pyx_t_8)) == ((PyObject *)((PyObject*)(&PyFloat_Type))));
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        if (__pyx_t_12) {
+        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_value, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_11 = (((PyObject *)Py_TYPE(__pyx_t_7)) == ((PyObject *)((PyObject*)(&PyFloat_Type))));
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        if (__pyx_t_11) {
 
-          /* "pysam/csamtools.pyx":2571
+          /* "csamtools.pyx":2571
  *                         # get data type - first value determines type
  *                         if type(value[0]) is float:
  *                             datafmt, datatype = "f", "f"             # <<<<<<<<<<<<<<
  *                         else:
  *                             mi, ma = min(value), max(value)
  */
-          __pyx_t_8 = ((PyObject *)__pyx_n_s__f);
-          __Pyx_INCREF(__pyx_t_8);
-          __pyx_t_2 = ((PyObject *)__pyx_n_s__f);
-          __Pyx_INCREF(__pyx_t_2);
+          __pyx_t_7 = ((PyObject *)__pyx_n_s__f);
+          __Pyx_INCREF(__pyx_t_7);
+          __pyx_t_1 = ((PyObject *)__pyx_n_s__f);
+          __Pyx_INCREF(__pyx_t_1);
           __Pyx_XDECREF(__pyx_v_datafmt);
-          __pyx_v_datafmt = __pyx_t_8;
-          __pyx_t_8 = 0;
+          __pyx_v_datafmt = __pyx_t_7;
+          __pyx_t_7 = 0;
           __Pyx_XDECREF(__pyx_v_datatype);
-          __pyx_v_datatype = __pyx_t_2;
-          __pyx_t_2 = 0;
-          goto __pyx_L10;
+          __pyx_v_datatype = __pyx_t_1;
+          __pyx_t_1 = 0;
+          goto __pyx_L12;
         }
         /*else*/ {
 
-          /* "pysam/csamtools.pyx":2573
+          /* "csamtools.pyx":2573
  *                             datafmt, datatype = "f", "f"
  *                         else:
  *                             mi, ma = min(value), max(value)             # <<<<<<<<<<<<<<
  *                             absmax = max( abs(mi), abs(ma) )
  *                             # signed ints
  */
-          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __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 = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
           __Pyx_INCREF(__pyx_v_value);
-          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_value);
+          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
           __Pyx_GIVEREF(__pyx_v_value);
-          __pyx_t_8 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          __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 = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_7 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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(((PyObject *)__pyx_t_1));
           __Pyx_INCREF(__pyx_v_value);
-          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_value);
+          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
           __Pyx_GIVEREF(__pyx_v_value);
-          __pyx_t_7 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
-          __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+          __pyx_t_6 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_6);
+          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
           __Pyx_XDECREF(__pyx_v_mi);
-          __pyx_v_mi = __pyx_t_8;
-          __pyx_t_8 = 0;
-          __Pyx_XDECREF(__pyx_v_ma);
-          __pyx_v_ma = __pyx_t_7;
+          __pyx_v_mi = __pyx_t_7;
           __pyx_t_7 = 0;
+          __Pyx_XDECREF(__pyx_v_ma);
+          __pyx_v_ma = __pyx_t_6;
+          __pyx_t_6 = 0;
 
-          /* "pysam/csamtools.pyx":2574
+          /* "csamtools.pyx":2574
  *                         else:
  *                             mi, ma = min(value), max(value)
  *                             absmax = max( abs(mi), abs(ma) )             # <<<<<<<<<<<<<<
  *                             # signed ints
  *                             if mi < 0:
  */
-          __pyx_t_7 = PyNumber_Absolute(__pyx_v_ma); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_6 = PyNumber_Absolute(__pyx_v_ma); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_6);
+          __pyx_t_7 = PyNumber_Absolute(__pyx_v_mi); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_7);
-          __pyx_t_8 = PyNumber_Absolute(__pyx_v_mi); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_8);
-          __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          if (__pyx_t_12) {
-            __Pyx_INCREF(__pyx_t_7);
-            __pyx_t_2 = __pyx_t_7;
+          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          if (__pyx_t_11) {
+            __Pyx_INCREF(__pyx_t_6);
+            __pyx_t_1 = __pyx_t_6;
           } else {
-            __Pyx_INCREF(__pyx_t_8);
-            __pyx_t_2 = __pyx_t_8;
+            __Pyx_INCREF(__pyx_t_7);
+            __pyx_t_1 = __pyx_t_7;
           }
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __pyx_t_7 = __pyx_t_2;
-          __Pyx_INCREF(__pyx_t_7);
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __Pyx_INCREF(__pyx_t_1);
           __Pyx_XDECREF(__pyx_v_absmax);
-          __pyx_v_absmax = __pyx_t_7;
-          __pyx_t_7 = 0;
+          __pyx_v_absmax = __pyx_t_1;
+          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-          /* "pysam/csamtools.pyx":2576
+          /* "csamtools.pyx":2576
  *                             absmax = max( abs(mi), abs(ma) )
  *                             # signed ints
  *                             if mi < 0:             # <<<<<<<<<<<<<<
  *                                 if mi >= -127: datafmt, datatype = "b", 'c'
  *                                 elif mi >= -32767: datafmt, datatype = "h", 's'
  */
-          __pyx_t_7 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          if (__pyx_t_12) {
+          __pyx_t_1 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+          if (__pyx_t_11) {
 
-            /* "pysam/csamtools.pyx":2577
+            /* "csamtools.pyx":2577
  *                             # signed ints
  *                             if mi < 0:
  *                                 if mi >= -127: datafmt, datatype = "b", 'c'             # <<<<<<<<<<<<<<
  *                                 elif mi >= -32767: datafmt, datatype = "h", 's'
  *                                 elif absmax < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  */
-            __pyx_t_7 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_neg_127, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-            if (__pyx_t_12) {
-              __pyx_t_7 = ((PyObject *)__pyx_n_s__b);
-              __Pyx_INCREF(__pyx_t_7);
-              __pyx_t_2 = ((PyObject *)__pyx_n_s__c);
-              __Pyx_INCREF(__pyx_t_2);
+            __pyx_t_1 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_neg_127, Py_GE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(__pyx_t_1);
+            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+            if (__pyx_t_11) {
+              __pyx_t_1 = ((PyObject *)__pyx_n_s__b);
+              __Pyx_INCREF(__pyx_t_1);
+              __pyx_t_6 = ((PyObject *)__pyx_n_s__c);
+              __Pyx_INCREF(__pyx_t_6);
               __Pyx_XDECREF(__pyx_v_datafmt);
-              __pyx_v_datafmt = __pyx_t_7;
-              __pyx_t_7 = 0;
+              __pyx_v_datafmt = __pyx_t_1;
+              __pyx_t_1 = 0;
               __Pyx_XDECREF(__pyx_v_datatype);
-              __pyx_v_datatype = __pyx_t_2;
-              __pyx_t_2 = 0;
-              goto __pyx_L12;
+              __pyx_v_datatype = __pyx_t_6;
+              __pyx_t_6 = 0;
+              goto __pyx_L14;
             }
 
-            /* "pysam/csamtools.pyx":2578
+            /* "csamtools.pyx":2578
  *                             if mi < 0:
  *                                 if mi >= -127: datafmt, datatype = "b", 'c'
  *                                 elif mi >= -32767: datafmt, datatype = "h", 's'             # <<<<<<<<<<<<<<
  *                                 elif absmax < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                                 else: datafmt, datatype = "i", 'i'
  */
-            __pyx_t_2 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_neg_32767, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-            if (__pyx_t_12) {
-              __pyx_t_2 = ((PyObject *)__pyx_n_s__h);
-              __Pyx_INCREF(__pyx_t_2);
-              __pyx_t_7 = ((PyObject *)__pyx_n_s__s);
-              __Pyx_INCREF(__pyx_t_7);
+            __pyx_t_6 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_neg_32767, Py_GE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(__pyx_t_6);
+            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+            if (__pyx_t_11) {
+              __pyx_t_6 = ((PyObject *)__pyx_n_s__h);
+              __Pyx_INCREF(__pyx_t_6);
+              __pyx_t_1 = ((PyObject *)__pyx_n_s__s);
+              __Pyx_INCREF(__pyx_t_1);
               __Pyx_XDECREF(__pyx_v_datafmt);
-              __pyx_v_datafmt = __pyx_t_2;
-              __pyx_t_2 = 0;
+              __pyx_v_datafmt = __pyx_t_6;
+              __pyx_t_6 = 0;
               __Pyx_XDECREF(__pyx_v_datatype);
-              __pyx_v_datatype = __pyx_t_7;
-              __pyx_t_7 = 0;
-              goto __pyx_L12;
+              __pyx_v_datatype = __pyx_t_1;
+              __pyx_t_1 = 0;
+              goto __pyx_L14;
             }
 
-            /* "pysam/csamtools.pyx":2579
+            /* "csamtools.pyx":2579
  *                                 if mi >= -127: datafmt, datatype = "b", 'c'
  *                                 elif mi >= -32767: datafmt, datatype = "h", 's'
  *                                 elif absmax < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )             # <<<<<<<<<<<<<<
  *                                 else: datafmt, datatype = "i", 'i'
  * 
  */
-            __pyx_t_7 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_neg_2147483648, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-            if (__pyx_t_12) {
-              __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 = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-              __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              __Pyx_GOTREF(__pyx_t_2);
-              PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_7));
-              __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
-              __pyx_t_7 = 0;
-              __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              __Pyx_GOTREF(__pyx_t_7);
-              __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-              __Pyx_Raise(__pyx_t_7, 0, 0, 0);
-              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+            __pyx_t_1 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_neg_2147483648, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(__pyx_t_1);
+            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+            if (__pyx_t_11) {
+              __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(((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;
+              __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+              __Pyx_GOTREF(__pyx_t_1);
+              __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              goto __pyx_L12;
+              goto __pyx_L14;
             }
             /*else*/ {
 
-              /* "pysam/csamtools.pyx":2580
+              /* "csamtools.pyx":2580
  *                                 elif mi >= -32767: datafmt, datatype = "h", 's'
  *                                 elif absmax < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                                 else: datafmt, datatype = "i", 'i'             # <<<<<<<<<<<<<<
  * 
  *                             # unsigned ints
  */
-              __pyx_t_7 = ((PyObject *)__pyx_n_s__i);
-              __Pyx_INCREF(__pyx_t_7);
-              __pyx_t_2 = ((PyObject *)__pyx_n_s__i);
-              __Pyx_INCREF(__pyx_t_2);
+              __pyx_t_1 = ((PyObject *)__pyx_n_s__i);
+              __Pyx_INCREF(__pyx_t_1);
+              __pyx_t_6 = ((PyObject *)__pyx_n_s__i);
+              __Pyx_INCREF(__pyx_t_6);
               __Pyx_XDECREF(__pyx_v_datafmt);
-              __pyx_v_datafmt = __pyx_t_7;
-              __pyx_t_7 = 0;
+              __pyx_v_datafmt = __pyx_t_1;
+              __pyx_t_1 = 0;
               __Pyx_XDECREF(__pyx_v_datatype);
-              __pyx_v_datatype = __pyx_t_2;
-              __pyx_t_2 = 0;
+              __pyx_v_datatype = __pyx_t_6;
+              __pyx_t_6 = 0;
             }
-            __pyx_L12:;
-            goto __pyx_L11;
+            __pyx_L14:;
+            goto __pyx_L13;
           }
           /*else*/ {
 
-            /* "pysam/csamtools.pyx":2584
+            /* "csamtools.pyx":2584
  *                             # unsigned ints
  *                             else:
  *                                 if absmax <= 255: datafmt, datatype = "B", 'C'             # <<<<<<<<<<<<<<
  *                                 elif absmax <= 65535: datafmt, datatype = "H", 'S'
  *                                 elif absmax > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  */
-            __pyx_t_2 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_255, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-            if (__pyx_t_12) {
-              __pyx_t_2 = ((PyObject *)__pyx_n_s__B);
-              __Pyx_INCREF(__pyx_t_2);
-              __pyx_t_7 = ((PyObject *)__pyx_n_s__C);
-              __Pyx_INCREF(__pyx_t_7);
+            __pyx_t_6 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_255, Py_LE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(__pyx_t_6);
+            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+            if (__pyx_t_11) {
+              __pyx_t_6 = ((PyObject *)__pyx_n_s__B);
+              __Pyx_INCREF(__pyx_t_6);
+              __pyx_t_1 = ((PyObject *)__pyx_n_s__C);
+              __Pyx_INCREF(__pyx_t_1);
               __Pyx_XDECREF(__pyx_v_datafmt);
-              __pyx_v_datafmt = __pyx_t_2;
-              __pyx_t_2 = 0;
+              __pyx_v_datafmt = __pyx_t_6;
+              __pyx_t_6 = 0;
               __Pyx_XDECREF(__pyx_v_datatype);
-              __pyx_v_datatype = __pyx_t_7;
-              __pyx_t_7 = 0;
-              goto __pyx_L13;
+              __pyx_v_datatype = __pyx_t_1;
+              __pyx_t_1 = 0;
+              goto __pyx_L15;
             }
 
-            /* "pysam/csamtools.pyx":2585
+            /* "csamtools.pyx":2585
  *                             else:
  *                                 if absmax <= 255: datafmt, datatype = "B", 'C'
  *                                 elif absmax <= 65535: datafmt, datatype = "H", 'S'             # <<<<<<<<<<<<<<
  *                                 elif absmax > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                                 else: datafmt, datatype = "I", 'I'
  */
-            __pyx_t_7 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_65535, Py_LE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-            if (__pyx_t_12) {
-              __pyx_t_7 = ((PyObject *)__pyx_n_s__H);
-              __Pyx_INCREF(__pyx_t_7);
-              __pyx_t_2 = ((PyObject *)__pyx_n_s__S);
-              __Pyx_INCREF(__pyx_t_2);
+            __pyx_t_1 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_65535, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(__pyx_t_1);
+            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+            if (__pyx_t_11) {
+              __pyx_t_1 = ((PyObject *)__pyx_n_s__H);
+              __Pyx_INCREF(__pyx_t_1);
+              __pyx_t_6 = ((PyObject *)__pyx_n_s__S);
+              __Pyx_INCREF(__pyx_t_6);
               __Pyx_XDECREF(__pyx_v_datafmt);
-              __pyx_v_datafmt = __pyx_t_7;
-              __pyx_t_7 = 0;
+              __pyx_v_datafmt = __pyx_t_1;
+              __pyx_t_1 = 0;
               __Pyx_XDECREF(__pyx_v_datatype);
-              __pyx_v_datatype = __pyx_t_2;
-              __pyx_t_2 = 0;
-              goto __pyx_L13;
+              __pyx_v_datatype = __pyx_t_6;
+              __pyx_t_6 = 0;
+              goto __pyx_L15;
             }
 
-            /* "pysam/csamtools.pyx":2586
+            /* "csamtools.pyx":2586
  *                                 if absmax <= 255: datafmt, datatype = "B", 'C'
  *                                 elif absmax <= 65535: datafmt, datatype = "H", 'S'
  *                                 elif absmax > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )             # <<<<<<<<<<<<<<
  *                                 else: datafmt, datatype = "I", 'I'
  * 
  */
-            __pyx_t_2 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_4294967295, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-            if (__pyx_t_12) {
-              __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-              __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              __Pyx_GOTREF(__pyx_t_7);
-              PyTuple_SET_ITEM(__pyx_t_7, 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_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              __Pyx_GOTREF(__pyx_t_2);
-              __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-              __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+            __pyx_t_6 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_4294967295, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(__pyx_t_6);
+            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+            if (__pyx_t_11) {
+              __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(((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;
+              __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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 = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              goto __pyx_L13;
+              goto __pyx_L15;
             }
             /*else*/ {
 
-              /* "pysam/csamtools.pyx":2587
+              /* "csamtools.pyx":2587
  *                                 elif absmax <= 65535: datafmt, datatype = "H", 'S'
  *                                 elif absmax > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                                 else: datafmt, datatype = "I", 'I'             # <<<<<<<<<<<<<<
  * 
  *                         datafmt = "2sccI%i%s" % (len(value), datafmt)
  */
-              __pyx_t_2 = ((PyObject *)__pyx_n_s__I);
-              __Pyx_INCREF(__pyx_t_2);
-              __pyx_t_7 = ((PyObject *)__pyx_n_s__I);
-              __Pyx_INCREF(__pyx_t_7);
+              __pyx_t_6 = ((PyObject *)__pyx_n_s__I);
+              __Pyx_INCREF(__pyx_t_6);
+              __pyx_t_1 = ((PyObject *)__pyx_n_s__I);
+              __Pyx_INCREF(__pyx_t_1);
               __Pyx_XDECREF(__pyx_v_datafmt);
-              __pyx_v_datafmt = __pyx_t_2;
-              __pyx_t_2 = 0;
+              __pyx_v_datafmt = __pyx_t_6;
+              __pyx_t_6 = 0;
               __Pyx_XDECREF(__pyx_v_datatype);
-              __pyx_v_datatype = __pyx_t_7;
-              __pyx_t_7 = 0;
+              __pyx_v_datatype = __pyx_t_1;
+              __pyx_t_1 = 0;
             }
-            __pyx_L13:;
+            __pyx_L15:;
           }
-          __pyx_L11:;
+          __pyx_L13:;
         }
-        __pyx_L10:;
+        __pyx_L12:;
 
-        /* "pysam/csamtools.pyx":2589
+        /* "csamtools.pyx":2589
  *                                 else: datafmt, datatype = "I", 'I'
  * 
  *                         datafmt = "2sccI%i%s" % (len(value), datafmt)             # <<<<<<<<<<<<<<
  *                         args.extend( [pytag[:2],
  *                                       pytype.encode('ascii'),
  */
-        __pyx_t_13 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
-        __Pyx_GIVEREF(__pyx_t_7);
+        __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __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(((PyObject *)__pyx_t_6));
+        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
+        __Pyx_GIVEREF(__pyx_t_1);
         __Pyx_INCREF(__pyx_v_datafmt);
-        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_datafmt);
+        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_datafmt);
         __Pyx_GIVEREF(__pyx_v_datafmt);
-        __pyx_t_7 = 0;
-        __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_141), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __pyx_t_1 = 0;
+        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_141), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_v_datafmt);
-        __pyx_v_datafmt = ((PyObject *)__pyx_t_7);
-        __pyx_t_7 = 0;
+        __pyx_v_datafmt = ((PyObject *)__pyx_t_1);
+        __pyx_t_1 = 0;
 
-        /* "pysam/csamtools.pyx":2590
+        /* "csamtools.pyx":2590
  * 
  *                         datafmt = "2sccI%i%s" % (len(value), datafmt)
  *                         args.extend( [pytag[:2],             # <<<<<<<<<<<<<<
  *                                       pytype.encode('ascii'),
  *                                       datatype.encode('ascii'),
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_args), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_args), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
 
-        /* "pysam/csamtools.pyx":2593
+        /* "csamtools.pyx":2593
  *                                       pytype.encode('ascii'),
  *                                       datatype.encode('ascii'),
  *                                       len(value)] + list(value) )             # <<<<<<<<<<<<<<
  *                         fmts.append( datafmt )
  *                         continue
  */
-        __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_pytag, 0, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_pytag, 0, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
-        /* "pysam/csamtools.pyx":2591
+        /* "csamtools.pyx":2591
  *                         datafmt = "2sccI%i%s" % (len(value), datafmt)
  *                         args.extend( [pytag[:2],
  *                                       pytype.encode('ascii'),             # <<<<<<<<<<<<<<
  *                                       datatype.encode('ascii'),
  *                                       len(value)] + list(value) )
  */
-        __pyx_t_8 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_s__encode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_s__encode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_142), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_142), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-        /* "pysam/csamtools.pyx":2592
+        /* "csamtools.pyx":2592
  *                         args.extend( [pytag[:2],
  *                                       pytype.encode('ascii'),
  *                                       datatype.encode('ascii'),             # <<<<<<<<<<<<<<
  *                                       len(value)] + list(value) )
  *                         fmts.append( datafmt )
  */
-        __pyx_t_8 = PyObject_GetAttr(__pyx_v_datatype, __pyx_n_s__encode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_14 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_143), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_14);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_datatype, __pyx_n_s__encode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_13 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_143), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_13);
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-        /* "pysam/csamtools.pyx":2593
+        /* "csamtools.pyx":2593
  *                                       pytype.encode('ascii'),
  *                                       datatype.encode('ascii'),
  *                                       len(value)] + list(value) )             # <<<<<<<<<<<<<<
  *                         fmts.append( datafmt )
  *                         continue
  */
-        __pyx_t_13 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_15 = PyList_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_15);
-        PyList_SET_ITEM(__pyx_t_15, 0, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
-        PyList_SET_ITEM(__pyx_t_15, 1, __pyx_t_9);
-        __Pyx_GIVEREF(__pyx_t_9);
-        PyList_SET_ITEM(__pyx_t_15, 2, __pyx_t_14);
-        __Pyx_GIVEREF(__pyx_t_14);
-        PyList_SET_ITEM(__pyx_t_15, 3, __pyx_t_8);
+        __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __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(((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);
         __Pyx_GIVEREF(__pyx_t_8);
-        __pyx_t_2 = 0;
-        __pyx_t_9 = 0;
-        __pyx_t_14 = 0;
+        PyList_SET_ITEM(__pyx_t_14, 2, __pyx_t_13);
+        __Pyx_GIVEREF(__pyx_t_13);
+        PyList_SET_ITEM(__pyx_t_14, 3, __pyx_t_7);
+        __Pyx_GIVEREF(__pyx_t_7);
+        __pyx_t_6 = 0;
         __pyx_t_8 = 0;
-        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __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(((PyObject *)__pyx_t_7));
         __Pyx_INCREF(__pyx_v_value);
-        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_value);
+        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_value);
         __Pyx_GIVEREF(__pyx_v_value);
-        __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_14);
-        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __pyx_t_8 = PyNumber_Add(((PyObject *)__pyx_t_15), __pyx_t_14); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-        __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
-        __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 = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_14);
-        PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_8));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-        __pyx_t_8 = 0;
-        __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_13);
+        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+        __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_14), __pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
         __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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(((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;
+        __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __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_13)); __pyx_t_13 = 0;
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-        /* "pysam/csamtools.pyx":2594
+        /* "csamtools.pyx":2594
  *                                       datatype.encode('ascii'),
  *                                       len(value)] + list(value) )
  *                         fmts.append( datafmt )             # <<<<<<<<<<<<<<
  *                         continue
  * 
  */
-        __pyx_t_16 = PyList_Append(__pyx_v_fmts, __pyx_v_datafmt); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        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;}
 
-        /* "pysam/csamtools.pyx":2595
+        /* "csamtools.pyx":2595
  *                                       len(value)] + list(value) )
  *                         fmts.append( datafmt )
  *                         continue             # <<<<<<<<<<<<<<
  * 
  *                     if t is float:
  */
-        goto __pyx_L4_continue;
-        goto __pyx_L9;
+        goto __pyx_L6_continue;
+        goto __pyx_L11;
       }
-      __pyx_L9:;
+      __pyx_L11:;
 
-      /* "pysam/csamtools.pyx":2597
+      /* "csamtools.pyx":2597
  *                         continue
  * 
  *                     if t is float:             # <<<<<<<<<<<<<<
  *                         fmt, pytype = "2scf", 'f'
  *                     elif t is int:
  */
-      __pyx_t_12 = (__pyx_v_t == ((PyObject*)(&PyFloat_Type)));
-      if (__pyx_t_12) {
+      __pyx_t_11 = (__pyx_v_t == ((PyObject*)(&PyFloat_Type)));
+      if (__pyx_t_11) {
 
-        /* "pysam/csamtools.pyx":2598
+        /* "csamtools.pyx":2598
  * 
  *                     if t is float:
  *                         fmt, pytype = "2scf", 'f'             # <<<<<<<<<<<<<<
  *                     elif t is int:
  *                         # negative values
  */
-        __pyx_t_8 = ((PyObject *)__pyx_kp_s__2scf);
-        __Pyx_INCREF(__pyx_t_8);
-        __pyx_t_14 = ((PyObject *)__pyx_n_s__f);
-        __Pyx_INCREF(__pyx_t_14);
+        __pyx_t_7 = ((PyObject *)__pyx_kp_s__2scf);
+        __Pyx_INCREF(__pyx_t_7);
+        __pyx_t_13 = ((PyObject *)__pyx_n_s__f);
+        __Pyx_INCREF(__pyx_t_13);
         __Pyx_XDECREF(__pyx_v_fmt);
-        __pyx_v_fmt = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_fmt = __pyx_t_7;
+        __pyx_t_7 = 0;
         __Pyx_XDECREF(__pyx_v_pytype);
-        __pyx_v_pytype = __pyx_t_14;
-        __pyx_t_14 = 0;
-        goto __pyx_L14;
+        __pyx_v_pytype = __pyx_t_13;
+        __pyx_t_13 = 0;
+        goto __pyx_L16;
       }
 
-      /* "pysam/csamtools.pyx":2599
+      /* "csamtools.pyx":2599
  *                     if t is float:
  *                         fmt, pytype = "2scf", 'f'
  *                     elif t is int:             # <<<<<<<<<<<<<<
  *                         # negative values
  *                         if value < 0:
  */
-      __pyx_t_12 = (__pyx_v_t == ((PyObject*)(&PyInt_Type)));
-      if (__pyx_t_12) {
+      __pyx_t_11 = (__pyx_v_t == ((PyObject*)(&PyInt_Type)));
+      if (__pyx_t_11) {
 
-        /* "pysam/csamtools.pyx":2601
+        /* "csamtools.pyx":2601
  *                     elif t is int:
  *                         # negative values
  *                         if value < 0:             # <<<<<<<<<<<<<<
  *                             if value >= -127: fmt, pytype = "2scb", 'c'
  *                             elif value >= -32767: fmt, pytype = "2sch", 's'
  */
-        __pyx_t_14 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-        if (__pyx_t_12) {
+        __pyx_t_13 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_13);
+        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+        if (__pyx_t_11) {
 
-          /* "pysam/csamtools.pyx":2602
+          /* "csamtools.pyx":2602
  *                         # negative values
  *                         if value < 0:
  *                             if value >= -127: fmt, pytype = "2scb", 'c'             # <<<<<<<<<<<<<<
  *                             elif value >= -32767: fmt, pytype = "2sch", 's'
  *                             elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  */
-          __pyx_t_14 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_127, Py_GE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-          if (__pyx_t_12) {
-            __pyx_t_14 = ((PyObject *)__pyx_kp_s__2scb);
-            __Pyx_INCREF(__pyx_t_14);
-            __pyx_t_8 = ((PyObject *)__pyx_n_s__c);
-            __Pyx_INCREF(__pyx_t_8);
+          __pyx_t_13 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_127, Py_GE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_13);
+          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+          if (__pyx_t_11) {
+            __pyx_t_13 = ((PyObject *)__pyx_kp_s__2scb);
+            __Pyx_INCREF(__pyx_t_13);
+            __pyx_t_7 = ((PyObject *)__pyx_n_s__c);
+            __Pyx_INCREF(__pyx_t_7);
             __Pyx_XDECREF(__pyx_v_fmt);
-            __pyx_v_fmt = __pyx_t_14;
-            __pyx_t_14 = 0;
+            __pyx_v_fmt = __pyx_t_13;
+            __pyx_t_13 = 0;
             __Pyx_XDECREF(__pyx_v_pytype);
-            __pyx_v_pytype = __pyx_t_8;
-            __pyx_t_8 = 0;
-            goto __pyx_L16;
+            __pyx_v_pytype = __pyx_t_7;
+            __pyx_t_7 = 0;
+            goto __pyx_L18;
           }
 
-          /* "pysam/csamtools.pyx":2603
+          /* "csamtools.pyx":2603
  *                         if value < 0:
  *                             if value >= -127: fmt, pytype = "2scb", 'c'
  *                             elif value >= -32767: fmt, pytype = "2sch", 's'             # <<<<<<<<<<<<<<
  *                             elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                             else: fmt, pytype = "2sci", 'i'
  */
-          __pyx_t_8 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_32767, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-          if (__pyx_t_12) {
-            __pyx_t_8 = ((PyObject *)__pyx_kp_s__2sch);
-            __Pyx_INCREF(__pyx_t_8);
-            __pyx_t_14 = ((PyObject *)__pyx_n_s__s);
-            __Pyx_INCREF(__pyx_t_14);
+          __pyx_t_7 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_32767, Py_GE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_7);
+          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+          if (__pyx_t_11) {
+            __pyx_t_7 = ((PyObject *)__pyx_kp_s__2sch);
+            __Pyx_INCREF(__pyx_t_7);
+            __pyx_t_13 = ((PyObject *)__pyx_n_s__s);
+            __Pyx_INCREF(__pyx_t_13);
             __Pyx_XDECREF(__pyx_v_fmt);
-            __pyx_v_fmt = __pyx_t_8;
-            __pyx_t_8 = 0;
+            __pyx_v_fmt = __pyx_t_7;
+            __pyx_t_7 = 0;
             __Pyx_XDECREF(__pyx_v_pytype);
-            __pyx_v_pytype = __pyx_t_14;
-            __pyx_t_14 = 0;
-            goto __pyx_L16;
+            __pyx_v_pytype = __pyx_t_13;
+            __pyx_t_13 = 0;
+            goto __pyx_L18;
           }
 
-          /* "pysam/csamtools.pyx":2604
+          /* "csamtools.pyx":2604
  *                             if value >= -127: fmt, pytype = "2scb", 'c'
  *                             elif value >= -32767: fmt, pytype = "2sch", 's'
  *                             elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )             # <<<<<<<<<<<<<<
  *                             else: fmt, pytype = "2sci", 'i'
  *                         # positive values
  */
-          __pyx_t_14 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_2147483648, Py_LT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-          if (__pyx_t_12) {
-            __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(((PyObject *)__pyx_t_14));
-            __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(__pyx_t_8);
-            PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_14));
-            __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
-            __pyx_t_14 = 0;
-            __pyx_t_14 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(__pyx_t_14);
-            __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-            __Pyx_Raise(__pyx_t_14, 0, 0, 0);
-            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+          __pyx_t_13 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_2147483648, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_13);
+          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+          if (__pyx_t_11) {
+            __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(((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;
+            __pyx_t_13 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(__pyx_t_13);
+            __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+            __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*/ {
 
-            /* "pysam/csamtools.pyx":2605
+            /* "csamtools.pyx":2605
  *                             elif value >= -32767: fmt, pytype = "2sch", 's'
  *                             elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                             else: fmt, pytype = "2sci", 'i'             # <<<<<<<<<<<<<<
  *                         # positive values
  *                         else:
  */
-            __pyx_t_14 = ((PyObject *)__pyx_kp_s__2sci);
-            __Pyx_INCREF(__pyx_t_14);
-            __pyx_t_8 = ((PyObject *)__pyx_n_s__i);
-            __Pyx_INCREF(__pyx_t_8);
+            __pyx_t_13 = ((PyObject *)__pyx_kp_s__2sci);
+            __Pyx_INCREF(__pyx_t_13);
+            __pyx_t_7 = ((PyObject *)__pyx_n_s__i);
+            __Pyx_INCREF(__pyx_t_7);
             __Pyx_XDECREF(__pyx_v_fmt);
-            __pyx_v_fmt = __pyx_t_14;
-            __pyx_t_14 = 0;
+            __pyx_v_fmt = __pyx_t_13;
+            __pyx_t_13 = 0;
             __Pyx_XDECREF(__pyx_v_pytype);
-            __pyx_v_pytype = __pyx_t_8;
-            __pyx_t_8 = 0;
+            __pyx_v_pytype = __pyx_t_7;
+            __pyx_t_7 = 0;
           }
-          __pyx_L16:;
-          goto __pyx_L15;
+          __pyx_L18:;
+          goto __pyx_L17;
         }
         /*else*/ {
 
-          /* "pysam/csamtools.pyx":2608
+          /* "csamtools.pyx":2608
  *                         # positive values
  *                         else:
  *                             if value <= 255: fmt, pytype = "2scB", 'C'             # <<<<<<<<<<<<<<
  *                             elif value <= 65535: fmt, pytype = "2scH", 'S'
  *                             elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  */
-          __pyx_t_8 = PyObject_RichCompare(__pyx_v_value, __pyx_int_255, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-          if (__pyx_t_12) {
-            __pyx_t_8 = ((PyObject *)__pyx_kp_s__2scB);
-            __Pyx_INCREF(__pyx_t_8);
-            __pyx_t_14 = ((PyObject *)__pyx_n_s__C);
-            __Pyx_INCREF(__pyx_t_14);
+          __pyx_t_7 = PyObject_RichCompare(__pyx_v_value, __pyx_int_255, Py_LE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_7);
+          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+          if (__pyx_t_11) {
+            __pyx_t_7 = ((PyObject *)__pyx_kp_s__2scB);
+            __Pyx_INCREF(__pyx_t_7);
+            __pyx_t_13 = ((PyObject *)__pyx_n_s__C);
+            __Pyx_INCREF(__pyx_t_13);
             __Pyx_XDECREF(__pyx_v_fmt);
-            __pyx_v_fmt = __pyx_t_8;
-            __pyx_t_8 = 0;
+            __pyx_v_fmt = __pyx_t_7;
+            __pyx_t_7 = 0;
             __Pyx_XDECREF(__pyx_v_pytype);
-            __pyx_v_pytype = __pyx_t_14;
-            __pyx_t_14 = 0;
-            goto __pyx_L17;
+            __pyx_v_pytype = __pyx_t_13;
+            __pyx_t_13 = 0;
+            goto __pyx_L19;
           }
 
-          /* "pysam/csamtools.pyx":2609
+          /* "csamtools.pyx":2609
  *                         else:
  *                             if value <= 255: fmt, pytype = "2scB", 'C'
  *                             elif value <= 65535: fmt, pytype = "2scH", 'S'             # <<<<<<<<<<<<<<
  *                             elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                             else: fmt, pytype = "2scI", 'I'
  */
-          __pyx_t_14 = PyObject_RichCompare(__pyx_v_value, __pyx_int_65535, Py_LE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-          if (__pyx_t_12) {
-            __pyx_t_14 = ((PyObject *)__pyx_kp_s__2scH);
-            __Pyx_INCREF(__pyx_t_14);
-            __pyx_t_8 = ((PyObject *)__pyx_n_s__S);
-            __Pyx_INCREF(__pyx_t_8);
+          __pyx_t_13 = PyObject_RichCompare(__pyx_v_value, __pyx_int_65535, Py_LE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_13);
+          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+          if (__pyx_t_11) {
+            __pyx_t_13 = ((PyObject *)__pyx_kp_s__2scH);
+            __Pyx_INCREF(__pyx_t_13);
+            __pyx_t_7 = ((PyObject *)__pyx_n_s__S);
+            __Pyx_INCREF(__pyx_t_7);
             __Pyx_XDECREF(__pyx_v_fmt);
-            __pyx_v_fmt = __pyx_t_14;
-            __pyx_t_14 = 0;
+            __pyx_v_fmt = __pyx_t_13;
+            __pyx_t_13 = 0;
             __Pyx_XDECREF(__pyx_v_pytype);
-            __pyx_v_pytype = __pyx_t_8;
-            __pyx_t_8 = 0;
-            goto __pyx_L17;
+            __pyx_v_pytype = __pyx_t_7;
+            __pyx_t_7 = 0;
+            goto __pyx_L19;
           }
 
-          /* "pysam/csamtools.pyx":2610
+          /* "csamtools.pyx":2610
  *                             if value <= 255: fmt, pytype = "2scB", 'C'
  *                             elif value <= 65535: fmt, pytype = "2scH", 'S'
  *                             elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )             # <<<<<<<<<<<<<<
  *                             else: fmt, pytype = "2scI", 'I'
  *                     else:
  */
-          __pyx_t_8 = PyObject_RichCompare(__pyx_v_value, __pyx_int_4294967295, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-          if (__pyx_t_12) {
-            __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-            __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(__pyx_t_14);
-            PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_8));
-            __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-            __pyx_t_8 = 0;
-            __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            __Pyx_GOTREF(__pyx_t_8);
-            __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
-            __Pyx_Raise(__pyx_t_8, 0, 0, 0);
-            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __pyx_t_7 = PyObject_RichCompare(__pyx_v_value, __pyx_int_4294967295, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_7);
+          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+          if (__pyx_t_11) {
+            __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(((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;
+            __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            __Pyx_GOTREF(__pyx_t_7);
+            __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+            __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*/ {
 
-            /* "pysam/csamtools.pyx":2611
+            /* "csamtools.pyx":2611
  *                             elif value <= 65535: fmt, pytype = "2scH", 'S'
  *                             elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
  *                             else: fmt, pytype = "2scI", 'I'             # <<<<<<<<<<<<<<
  *                     else:
  *                         # Note: hex strings (H) are not supported yet
  */
-            __pyx_t_8 = ((PyObject *)__pyx_kp_s__2scI);
-            __Pyx_INCREF(__pyx_t_8);
-            __pyx_t_14 = ((PyObject *)__pyx_n_s__I);
-            __Pyx_INCREF(__pyx_t_14);
+            __pyx_t_7 = ((PyObject *)__pyx_kp_s__2scI);
+            __Pyx_INCREF(__pyx_t_7);
+            __pyx_t_13 = ((PyObject *)__pyx_n_s__I);
+            __Pyx_INCREF(__pyx_t_13);
             __Pyx_XDECREF(__pyx_v_fmt);
-            __pyx_v_fmt = __pyx_t_8;
-            __pyx_t_8 = 0;
+            __pyx_v_fmt = __pyx_t_7;
+            __pyx_t_7 = 0;
             __Pyx_XDECREF(__pyx_v_pytype);
-            __pyx_v_pytype = __pyx_t_14;
-            __pyx_t_14 = 0;
+            __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*/ {
 
-        /* "pysam/csamtools.pyx":2614
+        /* "csamtools.pyx":2614
  *                     else:
  *                         # Note: hex strings (H) are not supported yet
  *                         if t is not bytes:             # <<<<<<<<<<<<<<
  *                             value = value.encode('ascii')
  *                         if len(value) == 1:
  */
-        __pyx_t_12 = (__pyx_v_t != ((PyObject*)(&PyBytes_Type)));
-        if (__pyx_t_12) {
+        __pyx_t_11 = (__pyx_v_t != ((PyObject*)(&PyBytes_Type)));
+        if (__pyx_t_11) {
 
-          /* "pysam/csamtools.pyx":2615
+          /* "csamtools.pyx":2615
  *                         # Note: hex strings (H) are not supported yet
  *                         if t is not bytes:
  *                             value = value.encode('ascii')             # <<<<<<<<<<<<<<
  *                         if len(value) == 1:
  *                             fmt, pytype = "2scc", 'A'
  */
-          __pyx_t_14 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__encode); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_14);
-          __pyx_t_8 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_k_tuple_144), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+          __pyx_t_13 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__encode); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_13);
+          __pyx_t_7 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_k_tuple_144), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_7);
+          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
           __Pyx_DECREF(__pyx_v_value);
-          __pyx_v_value = __pyx_t_8;
-          __pyx_t_8 = 0;
-          goto __pyx_L18;
+          __pyx_v_value = __pyx_t_7;
+          __pyx_t_7 = 0;
+          goto __pyx_L20;
         }
-        __pyx_L18:;
+        __pyx_L20:;
 
-        /* "pysam/csamtools.pyx":2616
+        /* "csamtools.pyx":2616
  *                         if t is not bytes:
  *                             value = value.encode('ascii')
  *                         if len(value) == 1:             # <<<<<<<<<<<<<<
  *                             fmt, pytype = "2scc", 'A'
  *                         else:
  */
-        __pyx_t_13 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_12 = (__pyx_t_13 == 1);
-        if (__pyx_t_12) {
+        __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = (__pyx_t_12 == 1);
+        if (__pyx_t_11) {
 
-          /* "pysam/csamtools.pyx":2617
+          /* "csamtools.pyx":2617
  *                             value = value.encode('ascii')
  *                         if len(value) == 1:
  *                             fmt, pytype = "2scc", 'A'             # <<<<<<<<<<<<<<
  *                         else:
  *                             fmt, pytype = "2sc%is" % (len(value)+1), 'Z'
  */
-          __pyx_t_8 = ((PyObject *)__pyx_kp_s__2scc);
-          __Pyx_INCREF(__pyx_t_8);
-          __pyx_t_14 = ((PyObject *)__pyx_n_s__A);
-          __Pyx_INCREF(__pyx_t_14);
+          __pyx_t_7 = ((PyObject *)__pyx_kp_s__2scc);
+          __Pyx_INCREF(__pyx_t_7);
+          __pyx_t_13 = ((PyObject *)__pyx_n_s__A);
+          __Pyx_INCREF(__pyx_t_13);
           __Pyx_XDECREF(__pyx_v_fmt);
-          __pyx_v_fmt = __pyx_t_8;
-          __pyx_t_8 = 0;
+          __pyx_v_fmt = __pyx_t_7;
+          __pyx_t_7 = 0;
           __Pyx_XDECREF(__pyx_v_pytype);
-          __pyx_v_pytype = __pyx_t_14;
-          __pyx_t_14 = 0;
-          goto __pyx_L19;
+          __pyx_v_pytype = __pyx_t_13;
+          __pyx_t_13 = 0;
+          goto __pyx_L21;
         }
         /*else*/ {
 
-          /* "pysam/csamtools.pyx":2619
+          /* "csamtools.pyx":2619
  *                             fmt, pytype = "2scc", 'A'
  *                         else:
  *                             fmt, pytype = "2sc%is" % (len(value)+1), 'Z'             # <<<<<<<<<<<<<<
  * 
  *                     args.extend( [pytag[:2],
  */
-          __pyx_t_13 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_14 = PyInt_FromSsize_t((__pyx_t_13 + 1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_14);
-          __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_145), __pyx_t_14); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-          __pyx_t_14 = ((PyObject *)__pyx_n_s__Z);
-          __Pyx_INCREF(__pyx_t_14);
+          __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_13 = PyInt_FromSsize_t((__pyx_t_12 + 1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_13);
+          __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_145), __pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+          __pyx_t_13 = ((PyObject *)__pyx_n_s__Z);
+          __Pyx_INCREF(__pyx_t_13);
           __Pyx_XDECREF(__pyx_v_fmt);
-          __pyx_v_fmt = ((PyObject *)__pyx_t_8);
-          __pyx_t_8 = 0;
+          __pyx_v_fmt = ((PyObject *)__pyx_t_7);
+          __pyx_t_7 = 0;
           __Pyx_XDECREF(__pyx_v_pytype);
-          __pyx_v_pytype = __pyx_t_14;
-          __pyx_t_14 = 0;
+          __pyx_v_pytype = __pyx_t_13;
+          __pyx_t_13 = 0;
         }
-        __pyx_L19:;
+        __pyx_L21:;
       }
-      __pyx_L14:;
+      __pyx_L16:;
 
-      /* "pysam/csamtools.pyx":2621
+      /* "csamtools.pyx":2621
  *                             fmt, pytype = "2sc%is" % (len(value)+1), 'Z'
  * 
  *                     args.extend( [pytag[:2],             # <<<<<<<<<<<<<<
  *                                   pytype.encode('ascii'),
  *                                   value ] )
  */
-      __pyx_t_14 = PyObject_GetAttr(((PyObject *)__pyx_v_args), __pyx_n_s__extend); 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_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_pytag, 0, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_v_args), __pyx_n_s__extend); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_13);
+      __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_pytag, 0, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
 
-      /* "pysam/csamtools.pyx":2622
+      /* "csamtools.pyx":2622
  * 
  *                     args.extend( [pytag[:2],
  *                                   pytype.encode('ascii'),             # <<<<<<<<<<<<<<
  *                                   value ] )
  * 
  */
-      __pyx_t_7 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_s__encode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_15 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_146), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_15);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_146), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_14);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":2623
+      /* "csamtools.pyx":2623
  *                     args.extend( [pytag[:2],
  *                                   pytype.encode('ascii'),
  *                                   value ] )             # <<<<<<<<<<<<<<
  * 
  *                     fmts.append( fmt )
  */
-      __pyx_t_7 = PyList_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
-      __Pyx_GIVEREF(__pyx_t_8);
-      PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_15);
-      __Pyx_GIVEREF(__pyx_t_15);
+      __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(((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);
+      __Pyx_GIVEREF(__pyx_t_14);
       __Pyx_INCREF(__pyx_v_value);
-      PyList_SET_ITEM(__pyx_t_7, 2, __pyx_v_value);
+      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_v_value);
       __Pyx_GIVEREF(__pyx_v_value);
-      __pyx_t_8 = 0;
-      __pyx_t_15 = 0;
-      __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_15);
-      PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_t_7));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
-      __Pyx_DECREF(__pyx_t_7); __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(((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;
+      __pyx_t_1 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_14), NULL); 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_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-      /* "pysam/csamtools.pyx":2625
+      /* "csamtools.pyx":2625
  *                                   value ] )
  * 
  *                     fmts.append( fmt )             # <<<<<<<<<<<<<<
  * 
  *                 fmt = "".join(fmts)
  */
-      __pyx_t_16 = PyList_Append(__pyx_v_fmts, __pyx_v_fmt); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_L4_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 = 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_L6_continue:;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":2627
+    /* "csamtools.pyx":2627
  *                     fmts.append( fmt )
  * 
  *                 fmt = "".join(fmts)             # <<<<<<<<<<<<<<
  *                 total_size = struct.calcsize(fmt)
  *                 buffer = ctypes.create_string_buffer(total_size)
  */
-    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_16), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __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(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(((PyObject *)__pyx_v_fmts));
-    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_fmts));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fmts));
     __Pyx_GIVEREF(((PyObject *)__pyx_v_fmts));
-    __pyx_t_15 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_15);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+    __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_14);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_XDECREF(__pyx_v_fmt);
-    __pyx_v_fmt = __pyx_t_15;
-    __pyx_t_15 = 0;
+    __pyx_v_fmt = __pyx_t_14;
+    __pyx_t_14 = 0;
 
-    /* "pysam/csamtools.pyx":2628
+    /* "csamtools.pyx":2628
  * 
  *                 fmt = "".join(fmts)
  *                 total_size = struct.calcsize(fmt)             # <<<<<<<<<<<<<<
  *                 buffer = ctypes.create_string_buffer(total_size)
  *                 struct.pack_into( fmt,
  */
-    __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_15);
-    __pyx_t_7 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__calcsize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__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 = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_15);
+    __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); 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_t_1 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__calcsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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(((PyObject *)__pyx_t_14));
     __Pyx_INCREF(__pyx_v_fmt);
-    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_fmt);
+    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_fmt);
     __Pyx_GIVEREF(__pyx_v_fmt);
-    __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
-    __pyx_v_total_size = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+    __pyx_v_total_size = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":2629
+    /* "csamtools.pyx":2629
  *                 fmt = "".join(fmts)
  *                 total_size = struct.calcsize(fmt)
  *                 buffer = ctypes.create_string_buffer(total_size)             # <<<<<<<<<<<<<<
  *                 struct.pack_into( fmt,
  *                                   buffer,
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s_147); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_15);
-    __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 = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); 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_t_14 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s_147); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_total_size);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_total_size);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_total_size);
     __Pyx_GIVEREF(__pyx_v_total_size);
-    __pyx_t_7 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_v_buffer = __pyx_t_7;
-    __pyx_t_7 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __pyx_v_buffer = __pyx_t_1;
+    __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":2630
+    /* "csamtools.pyx":2630
  *                 total_size = struct.calcsize(fmt)
  *                 buffer = ctypes.create_string_buffer(total_size)
  *                 struct.pack_into( fmt,             # <<<<<<<<<<<<<<
  *                                   buffer,
  *                                   0,
  */
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__pack_into); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); 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_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pack_into); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":2631
+    /* "csamtools.pyx":2631
  *                 buffer = ctypes.create_string_buffer(total_size)
  *                 struct.pack_into( fmt,
  *                                   buffer,             # <<<<<<<<<<<<<<
  *                                   0,
  *                                   *args )
  */
-    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __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(((PyObject *)__pyx_t_1));
     __Pyx_INCREF(__pyx_v_fmt);
-    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_fmt);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fmt);
     __Pyx_GIVEREF(__pyx_v_fmt);
     __Pyx_INCREF(__pyx_v_buffer);
-    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_buffer);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_buffer);
     __Pyx_GIVEREF(__pyx_v_buffer);
     __Pyx_INCREF(__pyx_int_0);
-    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_0);
+    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);
     __Pyx_GIVEREF(__pyx_int_0);
 
-    /* "pysam/csamtools.pyx":2633
+    /* "csamtools.pyx":2633
  *                                   buffer,
  *                                   0,
  *                                   *args )             # <<<<<<<<<<<<<<
  * 
  *             # delete the old data and allocate new space.
  */
-    __pyx_t_15 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_15));
-    __pyx_t_14 = PyNumber_Add(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_14));
-    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
-    __pyx_t_15 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_15);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_13 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_13));
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
-    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-    goto __pyx_L3;
+    __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_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_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
-
-  /* "pysam/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_17 = __Pyx_PyInt_AsSize_t(__pyx_v_total_size); if (unlikely((__pyx_t_17 == (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;}
 
-  /* "pysam/csamtools.pyx":2641
+  /* "csamtools.pyx":2641
  *                               src.l_aux,
  *                               total_size,
  *                               bam1_aux( src ) )             # <<<<<<<<<<<<<<
  * 
  *             src.l_aux = total_size
  */
-  pysam_bam_update(__pyx_v_src, __pyx_v_src->l_aux, __pyx_t_17, bam1_aux(__pyx_v_src));
+  pysam_bam_update(__pyx_v_src, __pyx_v_src->l_aux, __pyx_t_16, bam1_aux(__pyx_v_src));
 
-  /* "pysam/csamtools.pyx":2643
+  /* "csamtools.pyx":2643
  *                               bam1_aux( src ) )
  * 
  *             src.l_aux = total_size             # <<<<<<<<<<<<<<
  * 
  *             # copy data only if there is any
  */
-  __pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_v_total_size); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_src->l_aux = __pyx_t_18;
+  __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_total_size); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_src->l_aux = __pyx_t_17;
 
-  /* "pysam/csamtools.pyx":2646
+  /* "csamtools.pyx":2646
  * 
  *             # copy data only if there is any
  *             if total_size != 0:             # <<<<<<<<<<<<<<
  * 
  *                 # get location of new data
  */
-  __pyx_t_15 = PyObject_RichCompare(__pyx_v_total_size, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-  if (__pyx_t_12) {
+  __pyx_t_14 = PyObject_RichCompare(__pyx_v_total_size, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_14);
+  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+  if (__pyx_t_11) {
 
-    /* "pysam/csamtools.pyx":2649
+    /* "csamtools.pyx":2649
  * 
  *                 # get location of new data
  *                 s = bam1_aux( src )             # <<<<<<<<<<<<<<
@@ -25891,45 +24324,44 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_
  *                 # 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;}
 
-    /* "pysam/csamtools.pyx":2652
+    /* "csamtools.pyx":2652
  * 
  *                 # check if there is direct path from buffer.raw to tmp
  *                 temp = buffer.raw             # <<<<<<<<<<<<<<
  *                 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_15 = PyObject_GetAttr(__pyx_v_buffer, __pyx_n_s__raw); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_15);
-    __pyx_t_19 = PyBytes_AsString(__pyx_t_15); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-    __pyx_v_temp = __pyx_t_19;
+    __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;
+    __pyx_v_temp = __pyx_t_18;
 
-    /* "pysam/csamtools.pyx":2653
+    /* "csamtools.pyx":2653
  *                 # check if there is direct path from buffer.raw to tmp
  *                 temp = buffer.raw
  *                 memcpy( s, temp, total_size )             # <<<<<<<<<<<<<<
  * 
  *     property flag:
  */
-    __pyx_t_17 = __Pyx_PyInt_AsSize_t(__pyx_v_total_size); if (unlikely((__pyx_t_17 == (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_17);
-    goto __pyx_L20;
+    __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_L22;
   }
-  __pyx_L20:;
+  __pyx_L22:;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_13);
   __Pyx_XDECREF(__pyx_t_14);
-  __Pyx_XDECREF(__pyx_t_15);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.tags.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.tags.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_fmts);
@@ -25951,18 +24383,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4flag_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4flag_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4flag___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2657
+/* "csamtools.pyx":2657
  *     property flag:
  *         """properties flag"""
  *         def __get__(self): return self._delegate.core.flag             # <<<<<<<<<<<<<<
@@ -25970,7 +24391,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4flag_1__get__(PyObjec
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4flag___get__(struct __pyx_obj_5pysam_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;
@@ -25978,10 +24400,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4flag___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], 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;
@@ -25991,7 +24413,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4flag___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.flag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.flag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26000,18 +24422,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4flag___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4flag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_4flag_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_flag));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2658
+/* "csamtools.pyx":2658
  *         """properties flag"""
  *         def __get__(self): return self._delegate.core.flag
  *         def __set__(self, flag): self._delegate.core.flag = flag             # <<<<<<<<<<<<<<
@@ -26019,7 +24430,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4flag_3__set__(PyObject *__p
  *     property rname:
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_obj_5pysam_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;
@@ -26027,15 +24439,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4flag_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.flag.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.flag.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -26043,18 +24455,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5rname_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5rname_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_5rname___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2676
+/* "csamtools.pyx":2676
  * 
  *         """
  *         def __get__(self): return self._delegate.core.tid             # <<<<<<<<<<<<<<
@@ -26062,7 +24463,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5rname_1__get__(PyObje
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rname___get__(struct __pyx_obj_5pysam_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;
@@ -26070,10 +24472,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rname___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], 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;
@@ -26083,7 +24485,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rname___get__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.rname.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.rname.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26092,18 +24494,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rname___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5rname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_5rname_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2677
+/* "csamtools.pyx":2677
  *         """
  *         def __get__(self): return self._delegate.core.tid
  *         def __set__(self, tid): self._delegate.core.tid = tid             # <<<<<<<<<<<<<<
@@ -26111,7 +24502,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5rname_3__set__(PyObject *__
  *     property tid:
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx_obj_5pysam_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;
@@ -26119,15 +24511,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5rname_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.rname.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.rname.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -26135,18 +24527,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3tid_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_3tid___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2690
+/* "csamtools.pyx":2690
  * 
  *         """
  *         def __get__(self): return self._delegate.core.tid             # <<<<<<<<<<<<<<
@@ -26154,7 +24535,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3tid_1__get__(PyObject
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3tid___get__(struct __pyx_obj_5pysam_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;
@@ -26162,10 +24544,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3tid___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], 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;
@@ -26175,7 +24557,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3tid___get__(struct __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26184,18 +24566,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3tid___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_3tid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_3tid_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2691
+/* "csamtools.pyx":2691
  *         """
  *         def __get__(self): return self._delegate.core.tid
  *         def __set__(self, tid): self._delegate.core.tid = tid             # <<<<<<<<<<<<<<
@@ -26203,7 +24574,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_3tid_3__set__(PyObject *__py
  *     property pos:
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_obj_5pysam_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;
@@ -26211,15 +24583,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_o
   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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.tid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.tid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -26227,18 +24599,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3pos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_3pos___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2695
+/* "csamtools.pyx":2695
  *     property pos:
  *         """0-based leftmost coordinate"""
  *         def __get__(self): return self._delegate.core.pos             # <<<<<<<<<<<<<<
@@ -26246,7 +24607,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3pos_1__get__(PyObject
  *             ## setting the cigar string also updates the "bin" attribute
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3pos___get__(struct __pyx_obj_5pysam_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;
@@ -26254,10 +24616,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3pos___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], 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;
@@ -26267,7 +24629,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3pos___get__(struct __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26276,18 +24638,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3pos___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_3pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_3pos_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_pos));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2696
+/* "csamtools.pyx":2696
  *         """0-based leftmost coordinate"""
  *         def __get__(self): return self._delegate.core.pos
  *         def __set__(self, pos):             # <<<<<<<<<<<<<<
@@ -26295,30 +24646,29 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_3pos_3__set__(PyObject *__py
  *             cdef bam1_t * src
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_5pysam_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
-  bam1_t *__pyx_t_1;
-  int32_t __pyx_t_2;
+  int32_t __pyx_t_1;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2699
+  /* "csamtools.pyx":2699
  *             ## setting the cigar string also updates the "bin" attribute
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             if src.core.n_cigar:
  *                 src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2700
+  /* "csamtools.pyx":2700
  *             cdef bam1_t * src
  *             src = self._delegate
  *             if src.core.n_cigar:             # <<<<<<<<<<<<<<
@@ -26327,7 +24677,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_o
  */
   if (__pyx_v_src->core.n_cigar) {
 
-    /* "pysam/csamtools.pyx":2701
+    /* "csamtools.pyx":2701
  *             src = self._delegate
  *             if src.core.n_cigar:
  *                 src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )             # <<<<<<<<<<<<<<
@@ -26335,11 +24685,11 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_o
  *                 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*/ {
 
-    /* "pysam/csamtools.pyx":2703
+    /* "csamtools.pyx":2703
  *                 src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
  *             else:
  *                 src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)             # <<<<<<<<<<<<<<
@@ -26348,22 +24698,22 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_o
  */
     __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, (__pyx_v_src->core.pos + 1));
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2704
+  /* "csamtools.pyx":2704
  *             else:
  *                 src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)
  *             self._delegate.core.pos = pos             # <<<<<<<<<<<<<<
  *     property bin:
  *         """properties bin"""
  */
-  __pyx_t_2 = __Pyx_PyInt_from_py_int32_t(__pyx_v_pos); if (unlikely((__pyx_t_2 == (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_2;
+  __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;}
+  ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos = __pyx_t_1;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.pos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.pos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -26371,18 +24721,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3bin_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3bin_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_3bin___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2707
+/* "csamtools.pyx":2707
  *     property bin:
  *         """properties bin"""
  *         def __get__(self): return self._delegate.core.bin             # <<<<<<<<<<<<<<
@@ -26390,7 +24729,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_3bin_1__get__(PyObject
  *     property rlen:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3bin___get__(struct __pyx_obj_5pysam_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;
@@ -26398,10 +24738,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3bin___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], 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;
@@ -26411,7 +24751,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3bin___get__(struct __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.bin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.bin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26420,18 +24760,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_3bin___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_3bin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_3bin_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_bin));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2708
+/* "csamtools.pyx":2708
  *         """properties bin"""
  *         def __get__(self): return self._delegate.core.bin
  *         def __set__(self, bin): self._delegate.core.bin = bin             # <<<<<<<<<<<<<<
@@ -26439,7 +24768,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_3bin_3__set__(PyObject *__py
  *         '''length of the read (read only). Returns 0 if not given.'''
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_obj_5pysam_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;
@@ -26447,15 +24777,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_o
   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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.bin.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.bin.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -26463,18 +24793,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4rlen_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4rlen_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4rlen___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2711
+/* "csamtools.pyx":2711
  *     property rlen:
  *         '''length of the read (read only). Returns 0 if not given.'''
  *         def __get__(self): return self._delegate.core.l_qseq             # <<<<<<<<<<<<<<
@@ -26482,7 +24801,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4rlen_1__get__(PyObjec
  *         '''aligned reference position of the read on the reference genome.
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4rlen___get__(struct __pyx_obj_5pysam_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;
@@ -26490,10 +24810,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4rlen___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], 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;
@@ -26503,7 +24823,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4rlen___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.rlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.rlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26512,18 +24832,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4rlen___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4aend_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4aend_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4aend___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2717
+/* "csamtools.pyx":2717
  *         aend points to one past the last aligned residue.
  *         Returns None if not available.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -26531,56 +24840,55 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4aend_1__get__(PyObjec
  *             src = self._delegate
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4aend___get__(struct __pyx_obj_5pysam_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
-  bam1_t *__pyx_t_1;
+  PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   int __pyx_t_4;
   int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2719
+  /* "csamtools.pyx":2719
  *         def __get__(self):
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2720
+  /* "csamtools.pyx":2720
  *             cdef bam1_t * src
  *             src = self._delegate
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:             # <<<<<<<<<<<<<<
  *                 return None
  *             return bam_calend(&src.core, bam1_cigar(src))
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_2)) {__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);
-  __pyx_t_3 = PyNumber_And(__pyx_t_2, __pyx_int_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __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 = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (!__pyx_t_4) {
-    __pyx_t_5 = (__pyx_v_src->core.n_cigar == 0);
-    __pyx_t_6 = __pyx_t_5;
+  if (!__pyx_t_3) {
+    __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0);
+    __pyx_t_5 = __pyx_t_4;
   } else {
-    __pyx_t_6 = __pyx_t_4;
+    __pyx_t_5 = __pyx_t_3;
   }
-  if (__pyx_t_6) {
+  if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2721
+    /* "csamtools.pyx":2721
  *             src = self._delegate
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None             # <<<<<<<<<<<<<<
@@ -26591,11 +24899,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4aend___get__(struct _
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2722
+  /* "csamtools.pyx":2722
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None
  *             return bam_calend(&src.core, bam1_cigar(src))             # <<<<<<<<<<<<<<
@@ -26603,18 +24911,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4aend___get__(struct _
  *     property alen:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_r = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
   goto __pyx_L0;
 
   __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_3);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.aend.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.aend.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26623,18 +24931,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4aend___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4alen_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4alen_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4alen___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2727
+/* "csamtools.pyx":2727
  *         '''aligned length of the read on the reference genome.  Returns None if
  *         not available.'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -26642,56 +24939,55 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4alen_1__get__(PyObjec
  *             src = self._delegate
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4alen___get__(struct __pyx_obj_5pysam_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
-  bam1_t *__pyx_t_1;
+  PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   int __pyx_t_4;
   int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2729
+  /* "csamtools.pyx":2729
  *         def __get__(self):
  *             cdef bam1_t * src
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2730
+  /* "csamtools.pyx":2730
  *             cdef bam1_t * src
  *             src = self._delegate
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:             # <<<<<<<<<<<<<<
  *                 return None
  *             return bam_calend(&src.core,
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_2)) {__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);
-  __pyx_t_3 = PyNumber_And(__pyx_t_2, __pyx_int_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __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 = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (!__pyx_t_4) {
-    __pyx_t_5 = (__pyx_v_src->core.n_cigar == 0);
-    __pyx_t_6 = __pyx_t_5;
+  if (!__pyx_t_3) {
+    __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0);
+    __pyx_t_5 = __pyx_t_4;
   } else {
-    __pyx_t_6 = __pyx_t_4;
+    __pyx_t_5 = __pyx_t_3;
   }
-  if (__pyx_t_6) {
+  if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2731
+    /* "csamtools.pyx":2731
  *             src = self._delegate
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None             # <<<<<<<<<<<<<<
@@ -26702,11 +24998,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4alen___get__(struct _
     __Pyx_INCREF(Py_None);
     __pyx_r = Py_None;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2732
+  /* "csamtools.pyx":2732
  *             if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
  *                 return None
  *             return bam_calend(&src.core,             # <<<<<<<<<<<<<<
@@ -26715,25 +25011,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4alen___get__(struct _
  */
   __Pyx_XDECREF(__pyx_r);
 
-  /* "pysam/csamtools.pyx":2734
+  /* "csamtools.pyx":2734
  *             return bam_calend(&src.core,
  *                                bam1_cigar(src)) - \
  *                                self._delegate.core.pos             # <<<<<<<<<<<<<<
  * 
  *     property mapq:
  */
-  __pyx_t_3 = PyInt_FromLong((bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)) - __pyx_v_self->_delegate->core.pos)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_r = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __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;
   goto __pyx_L0;
 
   __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_3);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.alen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.alen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26742,18 +25038,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4alen___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mapq_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mapq_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2738
+/* "csamtools.pyx":2738
  *     property mapq:
  *         """mapping quality"""
  *         def __get__(self): return self._delegate.core.qual             # <<<<<<<<<<<<<<
@@ -26761,7 +25046,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mapq_1__get__(PyObjec
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq___get__(struct __pyx_obj_5pysam_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;
@@ -26769,10 +25055,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq___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], 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;
@@ -26782,7 +25068,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mapq.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mapq.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26791,18 +25077,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4mapq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_4mapq_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qual));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2739
+/* "csamtools.pyx":2739
  *         """mapping quality"""
  *         def __get__(self): return self._delegate.core.qual
  *         def __set__(self, qual): self._delegate.core.qual = qual             # <<<<<<<<<<<<<<
@@ -26810,7 +25085,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4mapq_3__set__(PyObject *__p
  *     property mrnm:
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_obj_5pysam_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;
@@ -26818,15 +25094,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mapq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mapq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -26834,18 +25110,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mrnm_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mrnm_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2745
+/* "csamtools.pyx":2745
  *         deprecated, use RNEXT instead.
  *         """
  *         def __get__(self): return self._delegate.core.mtid             # <<<<<<<<<<<<<<
@@ -26853,7 +25118,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mrnm_1__get__(PyObjec
  *     property rnext:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm___get__(struct __pyx_obj_5pysam_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;
@@ -26861,10 +25127,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm___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], 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;
@@ -26874,7 +25140,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mrnm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mrnm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26883,18 +25149,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4mrnm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_4mrnm_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mtid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2746
+/* "csamtools.pyx":2746
  *         """
  *         def __get__(self): return self._delegate.core.mtid
  *         def __set__(self, mtid): self._delegate.core.mtid = mtid             # <<<<<<<<<<<<<<
@@ -26902,7 +25157,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4mrnm_3__set__(PyObject *__p
  *         """the :term:`reference` id of the mate """
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_obj_5pysam_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;
@@ -26910,15 +25166,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mrnm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mrnm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -26926,18 +25182,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5rnext_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5rnext_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2749
+/* "csamtools.pyx":2749
  *     property rnext:
  *         """the :term:`reference` id of the mate """
  *         def __get__(self): return self._delegate.core.mtid             # <<<<<<<<<<<<<<
@@ -26945,7 +25190,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5rnext_1__get__(PyObje
  *     property mpos:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext___get__(struct __pyx_obj_5pysam_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;
@@ -26953,10 +25199,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext___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], 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;
@@ -26966,7 +25212,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext___get__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.rnext.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -26975,18 +25221,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5rnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_5rnext_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mtid));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2750
+/* "csamtools.pyx":2750
  *         """the :term:`reference` id of the mate """
  *         def __get__(self): return self._delegate.core.mtid
  *         def __set__(self, mtid): self._delegate.core.mtid = mtid             # <<<<<<<<<<<<<<
@@ -26994,7 +25229,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5rnext_3__set__(PyObject *__
  *         """the position of the mate
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx_obj_5pysam_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;
@@ -27002,15 +25238,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.rnext.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27018,18 +25254,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mpos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mpos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2754
+/* "csamtools.pyx":2754
  *         """the position of the mate
  *         deprecated, use PNEXT instead."""
  *         def __get__(self): return self._delegate.core.mpos             # <<<<<<<<<<<<<<
@@ -27037,7 +25262,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4mpos_1__get__(PyObjec
  *     property pnext:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos___get__(struct __pyx_obj_5pysam_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;
@@ -27045,10 +25271,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos___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], 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;
@@ -27058,7 +25284,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mpos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27067,18 +25293,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4mpos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_4mpos_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mpos));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2755
+/* "csamtools.pyx":2755
  *         deprecated, use PNEXT instead."""
  *         def __get__(self): return self._delegate.core.mpos
  *         def __set__(self, mpos): self._delegate.core.mpos = mpos             # <<<<<<<<<<<<<<
@@ -27086,7 +25301,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4mpos_3__set__(PyObject *__p
  *         """the position of the mate"""
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_obj_5pysam_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;
@@ -27094,15 +25310,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mpos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27110,18 +25326,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5pnext_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5pnext_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2758
+/* "csamtools.pyx":2758
  *     property pnext:
  *         """the position of the mate"""
  *         def __get__(self): return self._delegate.core.mpos             # <<<<<<<<<<<<<<
@@ -27129,7 +25334,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5pnext_1__get__(PyObje
  *     property isize:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext___get__(struct __pyx_obj_5pysam_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;
@@ -27137,10 +25343,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext___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], 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;
@@ -27150,7 +25356,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext___get__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.pnext.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27159,18 +25365,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5pnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_5pnext_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mpos));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2759
+/* "csamtools.pyx":2759
  *         """the position of the mate"""
  *         def __get__(self): return self._delegate.core.mpos
  *         def __set__(self, mpos): self._delegate.core.mpos = mpos             # <<<<<<<<<<<<<<
@@ -27178,7 +25373,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5pnext_3__set__(PyObject *__
  *         """the insert size
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx_obj_5pysam_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;
@@ -27186,15 +25382,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.pnext.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27202,18 +25398,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5isize_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5isize_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_5isize___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2763
+/* "csamtools.pyx":2763
  *         """the insert size
  *         deprecated: use tlen instead"""
  *         def __get__(self): return self._delegate.core.isize             # <<<<<<<<<<<<<<
@@ -27221,7 +25406,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_5isize_1__get__(PyObje
  *     property tlen:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5isize___get__(struct __pyx_obj_5pysam_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;
@@ -27229,10 +25415,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5isize___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], 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;
@@ -27242,7 +25428,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5isize___get__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.isize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.isize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27251,18 +25437,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_5isize___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5isize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_5isize_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_isize));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2764
+/* "csamtools.pyx":2764
  *         deprecated: use tlen instead"""
  *         def __get__(self): return self._delegate.core.isize
  *         def __set__(self, isize): self._delegate.core.isize = isize             # <<<<<<<<<<<<<<
@@ -27270,7 +25445,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_5isize_3__set__(PyObject *__
  *         """the insert size"""
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx_obj_5pysam_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;
@@ -27278,15 +25454,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5isize_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.isize.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.isize.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27294,18 +25470,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4tlen_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4tlen_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2767
+/* "csamtools.pyx":2767
  *     property tlen:
  *         """the insert size"""
  *         def __get__(self): return self._delegate.core.isize             # <<<<<<<<<<<<<<
@@ -27313,7 +25478,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_4tlen_1__get__(PyObjec
  *     property is_paired:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen___get__(struct __pyx_obj_5pysam_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;
@@ -27321,10 +25487,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen___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], 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;
@@ -27334,7 +25500,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.tlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27343,18 +25509,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4tlen_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_4tlen_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_isize));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2768
+/* "csamtools.pyx":2768
  *         """the insert size"""
  *         def __get__(self): return self._delegate.core.isize
  *         def __set__(self, isize): self._delegate.core.isize = isize             # <<<<<<<<<<<<<<
@@ -27362,7 +25517,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_4tlen_3__set__(PyObject *__p
  *         """true if read is paired in sequencing"""
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_obj_5pysam_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;
@@ -27370,15 +25526,15 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.tlen.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27386,18 +25542,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_9is_paired_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_9is_paired___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2771
+/* "csamtools.pyx":2771
  *     property is_paired:
  *         """true if read is paired in sequencing"""
  *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0             # <<<<<<<<<<<<<<
@@ -27405,7 +25550,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_9is_paired_1__get__(Py
  *             if val: self._delegate.core.flag |= BAM_FPAIRED
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired___get__(struct __pyx_obj_5pysam_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;
@@ -27413,10 +25559,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired___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], 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;
@@ -27426,7 +25572,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired___get__(str
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_paired.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27435,18 +25581,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired___get__(str
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_9is_paired_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_9is_paired_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2772
+/* "csamtools.pyx":2772
  *         """true if read is paired in sequencing"""
  *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -27454,7 +25589,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_9is_paired_3__set__(PyObject
  *             else: self._delegate.core.flag &= ~BAM_FPAIRED
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_obj_5pysam_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;
@@ -27462,10 +25598,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired_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], 2772);
 
-  /* "pysam/csamtools.pyx":2773
+  /* "csamtools.pyx":2773
  *         def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FPAIRED             # <<<<<<<<<<<<<<
@@ -27474,26 +25610,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired_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 = 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*/ {
 
-    /* "pysam/csamtools.pyx":2774
+    /* "csamtools.pyx":2774
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FPAIRED
  *             else: self._delegate.core.flag &= ~BAM_FPAIRED             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_paired.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27501,18 +25637,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_paired_2__set__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_14is_proper_pair_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_14is_proper_pair___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2777
+/* "csamtools.pyx":2777
  *     property is_proper_pair:
  *         """true if read is mapped in a proper pair"""
  *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0             # <<<<<<<<<<<<<<
@@ -27520,7 +25645,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_14is_proper_pair_1__ge
  *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair___get__(struct __pyx_obj_5pysam_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;
@@ -27529,15 +25655,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair___get
   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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -27548,7 +25675,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair___get
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_proper_pair.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27557,18 +25684,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair___get
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_14is_proper_pair_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_14is_proper_pair_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2778
+/* "csamtools.pyx":2778
  *         """true if read is mapped in a proper pair"""
  *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -27576,7 +25692,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_14is_proper_pair_3__set__(Py
  *             else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __pyx_obj_5pysam_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;
@@ -27584,10 +25701,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair_2__set__(st
   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);
 
-  /* "pysam/csamtools.pyx":2779
+  /* "csamtools.pyx":2779
  *         def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR             # <<<<<<<<<<<<<<
@@ -27596,26 +25713,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair_2__set__(st
  */
   __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*/ {
 
-    /* "pysam/csamtools.pyx":2780
+    /* "csamtools.pyx":2780
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
  *             else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_proper_pair.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27623,18 +25740,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_14is_proper_pair_2__set__(st
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_11is_unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_11is_unmapped___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2783
+/* "csamtools.pyx":2783
  *     property is_unmapped:
  *         """true if read itself is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FUNMAP) != 0             # <<<<<<<<<<<<<<
@@ -27642,7 +25748,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_11is_unmapped_1__get__
  *             if val: self._delegate.core.flag |= BAM_FUNMAP
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped___get__(struct __pyx_obj_5pysam_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;
@@ -27651,15 +25758,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped___get__(
   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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -27670,7 +25778,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped___get__(
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27679,18 +25787,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped___get__(
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_11is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_11is_unmapped_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2784
+/* "csamtools.pyx":2784
  *         """true if read itself is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FUNMAP) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -27698,7 +25795,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_11is_unmapped_3__set__(PyObj
  *             else: self._delegate.core.flag &= ~BAM_FUNMAP
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx_obj_5pysam_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;
@@ -27706,10 +25804,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped_2__set__(struc
   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);
 
-  /* "pysam/csamtools.pyx":2785
+  /* "csamtools.pyx":2785
  *         def __get__(self): return (self.flag & BAM_FUNMAP) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FUNMAP             # <<<<<<<<<<<<<<
@@ -27718,26 +25816,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped_2__set__(struc
  */
   __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*/ {
 
-    /* "pysam/csamtools.pyx":2786
+    /* "csamtools.pyx":2786
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FUNMAP
  *             else: self._delegate.core.flag &= ~BAM_FUNMAP             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_unmapped.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_unmapped.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27745,18 +25843,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_11is_unmapped_2__set__(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2789
+/* "csamtools.pyx":2789
  *     property mate_is_unmapped:
  *         """true if the mate is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FMUNMAP) != 0             # <<<<<<<<<<<<<<
@@ -27764,7 +25851,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_1__
  *             if val: self._delegate.core.flag |= BAM_FMUNMAP
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped___get__(struct __pyx_obj_5pysam_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;
@@ -27773,15 +25861,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped___g
   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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -27792,7 +25881,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped___g
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mate_is_unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27801,18 +25890,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped___g
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2790
+/* "csamtools.pyx":2790
  *         """true if the mate is unmapped"""
  *         def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -27820,7 +25898,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(
  *             else: self._delegate.core.flag &= ~BAM_FMUNMAP
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct __pyx_obj_5pysam_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;
@@ -27828,10 +25907,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(
   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);
 
-  /* "pysam/csamtools.pyx":2791
+  /* "csamtools.pyx":2791
  *         def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FMUNMAP             # <<<<<<<<<<<<<<
@@ -27840,26 +25919,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(
  */
   __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*/ {
 
-    /* "pysam/csamtools.pyx":2792
+    /* "csamtools.pyx":2792
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FMUNMAP
  *             else: self._delegate.core.flag &= ~BAM_FMUNMAP             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mate_is_unmapped.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_unmapped.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27867,18 +25946,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_10is_reverse_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_10is_reverse___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2795
+/* "csamtools.pyx":2795
  *     property is_reverse:
  *         """true if read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FREVERSE) != 0             # <<<<<<<<<<<<<<
@@ -27886,7 +25954,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_10is_reverse_1__get__(
  *             if val: self._delegate.core.flag |= BAM_FREVERSE
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10is_reverse___get__(struct __pyx_obj_5pysam_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;
@@ -27895,15 +25964,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10is_reverse___get__(s
   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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -27914,7 +25984,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10is_reverse___get__(s
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_reverse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_reverse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -27923,18 +25993,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10is_reverse___get__(s
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_10is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_10is_reverse_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2796
+/* "csamtools.pyx":2796
  *         """true if read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FREVERSE) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -27942,7 +26001,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_10is_reverse_3__set__(PyObje
  *             else: self._delegate.core.flag &= ~BAM_FREVERSE
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_obj_5pysam_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;
@@ -27950,10 +26010,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_10is_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], 2796);
 
-  /* "pysam/csamtools.pyx":2797
+  /* "csamtools.pyx":2797
  *         def __get__(self): return (self.flag & BAM_FREVERSE) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREVERSE             # <<<<<<<<<<<<<<
@@ -27962,26 +26022,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_10is_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 = 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*/ {
 
-    /* "pysam/csamtools.pyx":2798
+    /* "csamtools.pyx":2798
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREVERSE
  *             else: self._delegate.core.flag &= ~BAM_FREVERSE             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_reverse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_reverse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -27989,18 +26049,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_10is_reverse_2__set__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_15mate_is_reverse___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2801
+/* "csamtools.pyx":2801
  *     property mate_is_reverse:
  *         """true is read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FMREVERSE) != 0             # <<<<<<<<<<<<<<
@@ -28008,7 +26057,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_1__g
  *             if val: self._delegate.core.flag |= BAM_FMREVERSE
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse___get__(struct __pyx_obj_5pysam_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;
@@ -28017,15 +26067,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse___ge
   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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -28036,7 +26087,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse___ge
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mate_is_reverse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_reverse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -28045,18 +26096,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse___ge
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2802
+/* "csamtools.pyx":2802
  *         """true is read is mapped to reverse strand"""
  *         def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -28064,7 +26104,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(P
  *             else: self._delegate.core.flag &= ~BAM_FMREVERSE
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct __pyx_obj_5pysam_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;
@@ -28072,10 +26113,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(s
   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);
 
-  /* "pysam/csamtools.pyx":2803
+  /* "csamtools.pyx":2803
  *         def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FMREVERSE             # <<<<<<<<<<<<<<
@@ -28084,26 +26125,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(s
  */
   __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*/ {
 
-    /* "pysam/csamtools.pyx":2804
+    /* "csamtools.pyx":2804
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FMREVERSE
  *             else: self._delegate.core.flag &= ~BAM_FMREVERSE             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.mate_is_reverse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_reverse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -28111,18 +26152,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(s
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read1_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_8is_read1___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2807
+/* "csamtools.pyx":2807
  *     property is_read1:
  *         """true if this is read1"""
  *         def __get__(self): return (self.flag & BAM_FREAD1) != 0             # <<<<<<<<<<<<<<
@@ -28130,7 +26160,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read1_1__get__(PyO
  *             if val: self._delegate.core.flag |= BAM_FREAD1
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1___get__(struct __pyx_obj_5pysam_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;
@@ -28139,15 +26170,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1___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], 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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -28158,7 +26190,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1___get__(stru
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_read1.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_read1.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -28167,18 +26199,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1___get__(stru
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read1_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_8is_read1_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2808
+/* "csamtools.pyx":2808
  *         """true if this is read1"""
  *         def __get__(self): return (self.flag & BAM_FREAD1) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -28186,7 +26207,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read1_3__set__(PyObject
  *             else: self._delegate.core.flag &= ~BAM_FREAD1
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj_5pysam_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;
@@ -28194,10 +26216,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1_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], 2808);
 
-  /* "pysam/csamtools.pyx":2809
+  /* "csamtools.pyx":2809
  *         def __get__(self): return (self.flag & BAM_FREAD1) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREAD1             # <<<<<<<<<<<<<<
@@ -28206,26 +26228,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1_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 = 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*/ {
 
-    /* "pysam/csamtools.pyx":2810
+    /* "csamtools.pyx":2810
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREAD1
  *             else: self._delegate.core.flag &= ~BAM_FREAD1             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_read1.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_read1.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -28233,18 +26255,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read1_2__set__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read2_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_8is_read2___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2813
+/* "csamtools.pyx":2813
  *     property is_read2:
  *         """true if this is read2"""
  *         def __get__(self): return (self.flag & BAM_FREAD2) != 0             # <<<<<<<<<<<<<<
@@ -28252,7 +26263,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read2_1__get__(PyO
  *             if val: self._delegate.core.flag |= BAM_FREAD2
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2___get__(struct __pyx_obj_5pysam_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;
@@ -28261,15 +26273,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2___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], 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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -28280,7 +26293,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2___get__(stru
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_read2.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_read2.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -28289,18 +26302,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2___get__(stru
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_8is_read2_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2814
+/* "csamtools.pyx":2814
  *         """true if this is read2"""
  *         def __get__(self): return (self.flag & BAM_FREAD2) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -28308,7 +26310,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read2_3__set__(PyObject
  *             else: self._delegate.core.flag &= ~BAM_FREAD2
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj_5pysam_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;
@@ -28316,10 +26319,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2_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], 2814);
 
-  /* "pysam/csamtools.pyx":2815
+  /* "csamtools.pyx":2815
  *         def __get__(self): return (self.flag & BAM_FREAD2) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREAD2             # <<<<<<<<<<<<<<
@@ -28328,26 +26331,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2_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 = 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*/ {
 
-    /* "pysam/csamtools.pyx":2816
+    /* "csamtools.pyx":2816
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FREAD2
  *             else: self._delegate.core.flag &= ~BAM_FREAD2             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_read2.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_read2.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -28355,18 +26358,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_8is_read2_2__set__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_12is_secondary_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_12is_secondary___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2819
+/* "csamtools.pyx":2819
  *     property is_secondary:
  *         """true if not primary alignment"""
  *         def __get__(self): return (self.flag & BAM_FSECONDARY) != 0             # <<<<<<<<<<<<<<
@@ -28374,7 +26366,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_12is_secondary_1__get_
  *             if val: self._delegate.core.flag |= BAM_FSECONDARY
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary___get__(struct __pyx_obj_5pysam_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;
@@ -28383,15 +26376,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary___get__
   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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -28402,7 +26396,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary___get__
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_secondary.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_secondary.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -28411,18 +26405,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary___get__
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_12is_secondary_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_12is_secondary_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2820
+/* "csamtools.pyx":2820
  *         """true if not primary alignment"""
  *         def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -28430,7 +26413,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_12is_secondary_3__set__(PyOb
  *             else: self._delegate.core.flag &= ~BAM_FSECONDARY
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __pyx_obj_5pysam_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;
@@ -28438,10 +26422,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary_2__set__(stru
   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);
 
-  /* "pysam/csamtools.pyx":2821
+  /* "csamtools.pyx":2821
  *         def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FSECONDARY             # <<<<<<<<<<<<<<
@@ -28450,26 +26434,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary_2__set__(stru
  */
   __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*/ {
 
-    /* "pysam/csamtools.pyx":2822
+    /* "csamtools.pyx":2822
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FSECONDARY
  *             else: self._delegate.core.flag &= ~BAM_FSECONDARY             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_secondary.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_secondary.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -28477,18 +26461,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_secondary_2__set__(stru
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_9is_qcfail_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_9is_qcfail___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2825
+/* "csamtools.pyx":2825
  *     property is_qcfail:
  *         """true if QC failure"""
  *         def __get__(self): return (self.flag & BAM_FQCFAIL) != 0             # <<<<<<<<<<<<<<
@@ -28496,7 +26469,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_9is_qcfail_1__get__(Py
  *             if val: self._delegate.core.flag |= BAM_FQCFAIL
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail___get__(struct __pyx_obj_5pysam_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;
@@ -28505,15 +26479,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail___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], 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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -28524,7 +26499,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail___get__(str
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_qcfail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_qcfail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -28533,18 +26508,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail___get__(str
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_9is_qcfail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_9is_qcfail_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2826
+/* "csamtools.pyx":2826
  *         """true if QC failure"""
  *         def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -28552,7 +26516,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_9is_qcfail_3__set__(PyObject
  *             else: self._delegate.core.flag &= ~BAM_FQCFAIL
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_obj_5pysam_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;
@@ -28560,10 +26525,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail_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], 2826);
 
-  /* "pysam/csamtools.pyx":2827
+  /* "csamtools.pyx":2827
  *         def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FQCFAIL             # <<<<<<<<<<<<<<
@@ -28572,26 +26537,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail_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 = 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*/ {
 
-    /* "pysam/csamtools.pyx":2828
+    /* "csamtools.pyx":2828
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FQCFAIL
  *             else: self._delegate.core.flag &= ~BAM_FQCFAIL             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_qcfail.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_qcfail.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -28599,18 +26564,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_12is_duplicate_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_12is_duplicate___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2831
+/* "csamtools.pyx":2831
  *     property is_duplicate:
  *         """true if optical or PCR duplicate"""
  *         def __get__(self): return (self.flag & BAM_FDUP) != 0             # <<<<<<<<<<<<<<
@@ -28618,7 +26572,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_12is_duplicate_1__get_
  *             if val: self._delegate.core.flag |= BAM_FDUP
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate___get__(struct __pyx_obj_5pysam_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;
@@ -28627,15 +26582,16 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate___get__
   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);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -28646,7 +26602,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate___get__
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_duplicate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_duplicate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -28655,18 +26611,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate___get__
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11AlignedRead_12is_duplicate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_12is_duplicate_2__set__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2832
+/* "csamtools.pyx":2832
  *         """true if optical or PCR duplicate"""
  *         def __get__(self): return (self.flag & BAM_FDUP) != 0
  *         def __set__(self,val):             # <<<<<<<<<<<<<<
@@ -28674,7 +26619,8 @@ static int __pyx_pw_5pysam_9csamtools_11AlignedRead_12is_duplicate_3__set__(PyOb
  *             else: self._delegate.core.flag &= ~BAM_FDUP
  */
 
-static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __pyx_obj_5pysam_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;
@@ -28682,10 +26628,10 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate_2__set__(stru
   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);
 
-  /* "pysam/csamtools.pyx":2833
+  /* "csamtools.pyx":2833
  *         def __get__(self): return (self.flag & BAM_FDUP) != 0
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FDUP             # <<<<<<<<<<<<<<
@@ -28694,26 +26640,26 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate_2__set__(stru
  */
   __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*/ {
 
-    /* "pysam/csamtools.pyx":2834
+    /* "csamtools.pyx":2834
  *         def __set__(self,val):
  *             if val: self._delegate.core.flag |= BAM_FDUP
  *             else: self._delegate.core.flag &= ~BAM_FDUP             # <<<<<<<<<<<<<<
  *     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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.is_duplicate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.is_duplicate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -28721,18 +26667,7 @@ static int __pyx_pf_5pysam_9csamtools_11AlignedRead_12is_duplicate_2__set__(stru
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_9positions_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_9positions_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2837
+/* "csamtools.pyx":2837
  *     property positions:
  *         """a list of reference positions that this read aligns to."""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -28740,7 +26675,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_9positions_1__get__(Py
  *             cdef int op
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(struct __pyx_obj_5pysam_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;
@@ -28751,73 +26687,69 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(str
   PyObject *__pyx_v_l = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  int32_t __pyx_t_4;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  uint32_t __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
   uint32_t __pyx_t_5;
-  PyObject *__pyx_t_6 = NULL;
-  uint32_t __pyx_t_7;
-  int __pyx_t_8;
+  int __pyx_t_6;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2843
+  /* "csamtools.pyx":2843
  *             cdef bam1_t * src
  * 
  *             src = self._delegate             # <<<<<<<<<<<<<<
  *             if src.core.n_cigar == 0: return []
  * 
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2844
+  /* "csamtools.pyx":2844
  * 
  *             src = self._delegate
  *             if src.core.n_cigar == 0: return []             # <<<<<<<<<<<<<<
  * 
  *             result = []
  */
-  __pyx_t_2 = (__pyx_v_src->core.n_cigar == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_r = ((PyObject *)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __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(((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:;
 
-  /* "pysam/csamtools.pyx":2846
+  /* "csamtools.pyx":2846
  *             if src.core.n_cigar == 0: return []
  * 
  *             result = []             # <<<<<<<<<<<<<<
  *             pos = src.core.pos
  *             cigar_p = bam1_cigar(src)
  */
-  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_v_result = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __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(((PyObject *)__pyx_t_2));
+  __pyx_v_result = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":2847
+  /* "csamtools.pyx":2847
  * 
  *             result = []
  *             pos = src.core.pos             # <<<<<<<<<<<<<<
  *             cigar_p = bam1_cigar(src)
  * 
  */
-  __pyx_t_4 = __pyx_v_src->core.pos;
-  __pyx_v_pos = __pyx_t_4;
+  __pyx_v_pos = __pyx_v_src->core.pos;
 
-  /* "pysam/csamtools.pyx":2848
+  /* "csamtools.pyx":2848
  *             result = []
  *             pos = src.core.pos
  *             cigar_p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -28826,17 +26758,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(str
  */
   __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2850
+  /* "csamtools.pyx":2850
  *             cigar_p = bam1_cigar(src)
  * 
  *             for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  */
-  __pyx_t_5 = __pyx_v_src->core.n_cigar;
-  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_5; __pyx_v_k++) {
+  __pyx_t_3 = __pyx_v_src->core.n_cigar;
+  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
 
-    /* "pysam/csamtools.pyx":2851
+    /* "csamtools.pyx":2851
  * 
  *             for k from 0 <= k < src.core.n_cigar:
  *                 op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -28845,62 +26777,65 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(str
  */
     __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-    /* "pysam/csamtools.pyx":2852
+    /* "csamtools.pyx":2852
  *             for k from 0 <= k < src.core.n_cigar:
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  *                 if op == BAM_CMATCH:
  *                     for i from pos <= i < pos + l:
  */
-    __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_XDECREF(__pyx_v_l);
-    __pyx_v_l = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_l = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":2853
+    /* "csamtools.pyx":2853
  *                 op = cigar_p[k] & BAM_CIGAR_MASK
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 if op == BAM_CMATCH:             # <<<<<<<<<<<<<<
  *                     for i from pos <= i < pos + l:
  *                         result.append( i )
  */
-    __pyx_t_2 = (__pyx_v_op == 0);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_v_op == 0);
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2854
+      /* "csamtools.pyx":2854
  *                 l = cigar_p[k] >> BAM_CIGAR_SHIFT
  *                 if op == BAM_CMATCH:
  *                     for i from pos <= i < pos + l:             # <<<<<<<<<<<<<<
  *                         result.append( i )
  * 
  */
-      __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_7 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
+      __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
-        /* "pysam/csamtools.pyx":2855
+        /* "csamtools.pyx":2855
  *                 if op == BAM_CMATCH:
  *                     for i from pos <= i < pos + l:
  *                         result.append( i )             # <<<<<<<<<<<<<<
  * 
  *                 if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
  */
-        __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_8 = PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        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:;
 
-    /* "pysam/csamtools.pyx":2857
+    /* "csamtools.pyx":2857
  *                         result.append( i )
  * 
  *                 if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:             # <<<<<<<<<<<<<<
@@ -28912,26 +26847,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(str
       case 2:
       case 3:
 
-      /* "pysam/csamtools.pyx":2858
+      /* "csamtools.pyx":2858
  * 
  *                 if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
  *                     pos += l             # <<<<<<<<<<<<<<
  * 
  *             return result
  */
-      __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_7 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_v_pos = __pyx_t_7;
+      __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_v_pos = __pyx_t_5;
       break;
     }
   }
 
-  /* "pysam/csamtools.pyx":2860
+  /* "csamtools.pyx":2860
  *                     pos += l
  * 
  *             return result             # <<<<<<<<<<<<<<
@@ -28946,9 +26881,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(str
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.positions.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("csamtools.AlignedRead.positions.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_result);
@@ -28959,18 +26894,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_9positions___get__(str
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_13aligned_pairs_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get__(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2867
+/* "csamtools.pyx":2867
  *        Unaligned position are marked by None.
  *        """
  *        def __get__(self):             # <<<<<<<<<<<<<<
@@ -28978,7 +26902,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_13aligned_pairs_1__get
  *            cdef int op
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get__(struct __pyx_obj_5pysam_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;
@@ -28990,74 +26915,70 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
   PyObject *__pyx_v_l = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  int32_t __pyx_t_4;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  uint32_t __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
   uint32_t __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  uint32_t __pyx_t_7;
-  PyObject *__pyx_t_8 = NULL;
-  int __pyx_t_9;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   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);
 
-  /* "pysam/csamtools.pyx":2873
+  /* "csamtools.pyx":2873
  *            cdef bam1_t * src
  * 
  *            src = self._delegate             # <<<<<<<<<<<<<<
  *            if src.core.n_cigar == 0: return []
  * 
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2874
+  /* "csamtools.pyx":2874
  * 
  *            src = self._delegate
  *            if src.core.n_cigar == 0: return []             # <<<<<<<<<<<<<<
  * 
  *            result = []
  */
-  __pyx_t_2 = (__pyx_v_src->core.n_cigar == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_r = ((PyObject *)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __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(((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:;
 
-  /* "pysam/csamtools.pyx":2876
+  /* "csamtools.pyx":2876
  *            if src.core.n_cigar == 0: return []
  * 
  *            result = []             # <<<<<<<<<<<<<<
  *            pos = src.core.pos
  *            qpos = 0
  */
-  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_v_result = __pyx_t_3;
-  __pyx_t_3 = 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(((PyObject *)__pyx_t_2));
+  __pyx_v_result = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":2877
+  /* "csamtools.pyx":2877
  * 
  *            result = []
  *            pos = src.core.pos             # <<<<<<<<<<<<<<
  *            qpos = 0
  *            cigar_p = bam1_cigar(src)
  */
-  __pyx_t_4 = __pyx_v_src->core.pos;
-  __pyx_v_pos = __pyx_t_4;
+  __pyx_v_pos = __pyx_v_src->core.pos;
 
-  /* "pysam/csamtools.pyx":2878
+  /* "csamtools.pyx":2878
  *            result = []
  *            pos = src.core.pos
  *            qpos = 0             # <<<<<<<<<<<<<<
@@ -29066,7 +26987,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
  */
   __pyx_v_qpos = 0;
 
-  /* "pysam/csamtools.pyx":2879
+  /* "csamtools.pyx":2879
  *            pos = src.core.pos
  *            qpos = 0
  *            cigar_p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -29075,17 +26996,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
  */
   __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2881
+  /* "csamtools.pyx":2881
  *            cigar_p = bam1_cigar(src)
  * 
  *            for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
  *                op = cigar_p[k] & BAM_CIGAR_MASK
  *                l = cigar_p[k] >> BAM_CIGAR_SHIFT
  */
-  __pyx_t_5 = __pyx_v_src->core.n_cigar;
-  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_5; __pyx_v_k++) {
+  __pyx_t_3 = __pyx_v_src->core.n_cigar;
+  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
 
-    /* "pysam/csamtools.pyx":2882
+    /* "csamtools.pyx":2882
  * 
  *            for k from 0 <= k < src.core.n_cigar:
  *                op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -29094,20 +27015,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
  */
     __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-    /* "pysam/csamtools.pyx":2883
+    /* "csamtools.pyx":2883
  *            for k from 0 <= k < src.core.n_cigar:
  *                op = cigar_p[k] & BAM_CIGAR_MASK
  *                l = cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  * 
  *                if op == BAM_CMATCH:
  */
-    __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_XDECREF(__pyx_v_l);
-    __pyx_v_l = __pyx_t_3;
-    __pyx_t_3 = 0;
+    __pyx_v_l = __pyx_t_2;
+    __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":2896
+    /* "csamtools.pyx":2896
  *                        qpos += 1
  * 
  *                elif op == BAM_CDEL or op == BAM_CREF_SKIP:             # <<<<<<<<<<<<<<
@@ -29116,7 +27037,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
  */
     switch (__pyx_v_op) {
 
-      /* "pysam/csamtools.pyx":2885
+      /* "csamtools.pyx":2885
  *                l = cigar_p[k] >> BAM_CIGAR_SHIFT
  * 
  *                if op == BAM_CMATCH:             # <<<<<<<<<<<<<<
@@ -29125,45 +27046,48 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
  */
       case 0:
 
-      /* "pysam/csamtools.pyx":2886
+      /* "csamtools.pyx":2886
  * 
  *                if op == BAM_CMATCH:
  *                    for i from pos <= i < pos + l:             # <<<<<<<<<<<<<<
  *                        result.append( (qpos, i) )
  *                        qpos += 1
  */
-      __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_7 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
+      __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
-        /* "pysam/csamtools.pyx":2887
+        /* "csamtools.pyx":2887
  *                if op == BAM_CMATCH:
  *                    for i from pos <= i < pos + l:
  *                        result.append( (qpos, i) )             # <<<<<<<<<<<<<<
  *                        qpos += 1
  *                    pos += l
  */
-        __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_qpos); 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_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
-        __Pyx_GIVEREF(__pyx_t_6);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
-        __Pyx_GIVEREF(__pyx_t_3);
-        __pyx_t_6 = 0;
-        __pyx_t_3 = 0;
-        __pyx_t_9 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+        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(((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);
+        __Pyx_GIVEREF(__pyx_t_2);
+        __pyx_t_4 = 0;
+        __pyx_t_2 = 0;
+        __pyx_t_7 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
 
-        /* "pysam/csamtools.pyx":2888
+        /* "csamtools.pyx":2888
  *                    for i from pos <= i < pos + l:
  *                        result.append( (qpos, i) )
  *                        qpos += 1             # <<<<<<<<<<<<<<
@@ -29173,24 +27097,24 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
         __pyx_v_qpos = (__pyx_v_qpos + 1);
       }
 
-      /* "pysam/csamtools.pyx":2889
+      /* "csamtools.pyx":2889
  *                        result.append( (qpos, i) )
  *                        qpos += 1
  *                    pos += l             # <<<<<<<<<<<<<<
  * 
  *                elif op == BAM_CINS:
  */
-      __pyx_t_8 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_7 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_v_pos = __pyx_t_7;
+      __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_v_pos = __pyx_t_5;
       break;
 
-      /* "pysam/csamtools.pyx":2891
+      /* "csamtools.pyx":2891
  *                    pos += l
  * 
  *                elif op == BAM_CINS:             # <<<<<<<<<<<<<<
@@ -29199,43 +27123,46 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
  */
       case 1:
 
-      /* "pysam/csamtools.pyx":2892
+      /* "csamtools.pyx":2892
  * 
  *                elif op == BAM_CINS:
  *                    for i from pos <= i < pos + l:             # <<<<<<<<<<<<<<
  *                        result.append( (qpos, None) )
  *                        qpos += 1
  */
-      __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_7 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_8); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
+      __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
-        /* "pysam/csamtools.pyx":2893
+        /* "csamtools.pyx":2893
  *                elif op == BAM_CINS:
  *                    for i from pos <= i < pos + l:
  *                        result.append( (qpos, None) )             # <<<<<<<<<<<<<<
  *                        qpos += 1
  * 
  */
-        __pyx_t_8 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_qpos); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
-        __Pyx_GIVEREF(__pyx_t_8);
+        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(((PyObject *)__pyx_t_2));
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         __Pyx_INCREF(Py_None);
-        PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None);
+        PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
         __Pyx_GIVEREF(Py_None);
-        __pyx_t_8 = 0;
-        __pyx_t_9 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+        __pyx_t_6 = 0;
+        __pyx_t_7 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-        /* "pysam/csamtools.pyx":2894
+        /* "csamtools.pyx":2894
  *                    for i from pos <= i < pos + l:
  *                        result.append( (qpos, None) )
  *                        qpos += 1             # <<<<<<<<<<<<<<
@@ -29246,7 +27173,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
       }
       break;
 
-      /* "pysam/csamtools.pyx":2896
+      /* "csamtools.pyx":2896
  *                        qpos += 1
  * 
  *                elif op == BAM_CDEL or op == BAM_CREF_SKIP:             # <<<<<<<<<<<<<<
@@ -29256,63 +27183,66 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
       case 2:
       case 3:
 
-      /* "pysam/csamtools.pyx":2897
+      /* "csamtools.pyx":2897
  * 
  *                elif op == BAM_CDEL or op == BAM_CREF_SKIP:
  *                    for i from pos <= i < pos + l:             # <<<<<<<<<<<<<<
  *                        result.append( (None, i) )
  *                    pos += l
  */
-      __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_7 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_8); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
+      __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
 
-        /* "pysam/csamtools.pyx":2898
+        /* "csamtools.pyx":2898
  *                elif op == BAM_CDEL or op == BAM_CREF_SKIP:
  *                    for i from pos <= i < pos + l:
  *                        result.append( (None, i) )             # <<<<<<<<<<<<<<
  *                    pos += l
  * 
  */
-        __pyx_t_8 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        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(((PyObject *)__pyx_t_2));
         __Pyx_INCREF(Py_None);
-        PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, Py_None);
         __Pyx_GIVEREF(Py_None);
-        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8);
-        __Pyx_GIVEREF(__pyx_t_8);
-        __pyx_t_8 = 0;
-        __pyx_t_9 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
+        __pyx_t_6 = 0;
+        __pyx_t_7 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       }
 
-      /* "pysam/csamtools.pyx":2899
+      /* "csamtools.pyx":2899
  *                    for i from pos <= i < pos + l:
  *                        result.append( (None, i) )
  *                    pos += l             # <<<<<<<<<<<<<<
  * 
  *            return result
  */
-      __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_7 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_8); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_v_pos = __pyx_t_7;
+      __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_v_pos = __pyx_t_5;
       break;
     }
   }
 
-  /* "pysam/csamtools.pyx":2901
+  /* "csamtools.pyx":2901
  *                    pos += l
  * 
  *            return result             # <<<<<<<<<<<<<<
@@ -29327,10 +27257,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.aligned_pairs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.aligned_pairs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_result);
@@ -29341,40 +27271,71 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_13aligned_pairs___get_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_11overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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_5pysam_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;
-  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       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;
@@ -29389,54 +27350,12 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_11overlap(PyObject *__
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.overlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.overlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), __pyx_v_start, __pyx_v_end);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
 
-/* "pysam/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_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_5pysam_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
-  bam1_t *__pyx_t_1;
-  int __pyx_t_2;
-  int32_t __pyx_t_3;
-  uint32_t __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  uint32_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *__pyx_t_9 = NULL;
-  uint32_t __pyx_t_10;
-  uint32_t __pyx_t_11;
-  int __pyx_t_12;
-  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);
-
-  /* "pysam/csamtools.pyx":2913
+  /* "csamtools.pyx":2913
  *         cdef bam1_t * src
  * 
  *         overlap = 0             # <<<<<<<<<<<<<<
@@ -29445,44 +27364,42 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx
  */
   __pyx_v_overlap = 0;
 
-  /* "pysam/csamtools.pyx":2915
+  /* "csamtools.pyx":2915
  *         overlap = 0
  * 
  *         src = self._delegate             # <<<<<<<<<<<<<<
  *         if src.core.n_cigar == 0: return 0
  *         pos = src.core.pos
  */
-  __pyx_t_1 = __pyx_v_self->_delegate;
-  __pyx_v_src = __pyx_t_1;
+  __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
 
-  /* "pysam/csamtools.pyx":2916
+  /* "csamtools.pyx":2916
  * 
  *         src = self._delegate
  *         if src.core.n_cigar == 0: return 0             # <<<<<<<<<<<<<<
  *         pos = src.core.pos
  *         o = 0
  */
-  __pyx_t_2 = (__pyx_v_src->core.n_cigar == 0);
-  if (__pyx_t_2) {
+  __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __Pyx_INCREF(__pyx_int_0);
     __pyx_r = __pyx_int_0;
     goto __pyx_L0;
-    goto __pyx_L3;
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":2917
+  /* "csamtools.pyx":2917
  *         src = self._delegate
  *         if src.core.n_cigar == 0: return 0
  *         pos = src.core.pos             # <<<<<<<<<<<<<<
  *         o = 0
  * 
  */
-  __pyx_t_3 = __pyx_v_src->core.pos;
-  __pyx_v_pos = __pyx_t_3;
+  __pyx_v_pos = __pyx_v_src->core.pos;
 
-  /* "pysam/csamtools.pyx":2918
+  /* "csamtools.pyx":2918
  *         if src.core.n_cigar == 0: return 0
  *         pos = src.core.pos
  *         o = 0             # <<<<<<<<<<<<<<
@@ -29491,7 +27408,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx
  */
   __pyx_v_o = 0;
 
-  /* "pysam/csamtools.pyx":2920
+  /* "csamtools.pyx":2920
  *         o = 0
  * 
  *         cigar_p = bam1_cigar(src)             # <<<<<<<<<<<<<<
@@ -29500,17 +27417,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx
  */
   __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
 
-  /* "pysam/csamtools.pyx":2921
+  /* "csamtools.pyx":2921
  * 
  *         cigar_p = bam1_cigar(src)
  *         for k from 0 <= k < src.core.n_cigar:             # <<<<<<<<<<<<<<
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             l = cigar_p[k] >> BAM_CIGAR_SHIFT
  */
-  __pyx_t_4 = __pyx_v_src->core.n_cigar;
-  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_4; __pyx_v_k++) {
+  __pyx_t_2 = __pyx_v_src->core.n_cigar;
+  for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) {
 
-    /* "pysam/csamtools.pyx":2922
+    /* "csamtools.pyx":2922
  *         cigar_p = bam1_cigar(src)
  *         for k from 0 <= k < src.core.n_cigar:
  *             op = cigar_p[k] & BAM_CIGAR_MASK             # <<<<<<<<<<<<<<
@@ -29519,93 +27436,94 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx
  */
     __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
 
-    /* "pysam/csamtools.pyx":2923
+    /* "csamtools.pyx":2923
  *         for k from 0 <= k < src.core.n_cigar:
  *             op = cigar_p[k] & BAM_CIGAR_MASK
  *             l = cigar_p[k] >> BAM_CIGAR_SHIFT             # <<<<<<<<<<<<<<
  * 
  *             if op == BAM_CMATCH:
  */
-    __pyx_t_5 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_XDECREF(__pyx_v_l);
-    __pyx_v_l = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_v_l = __pyx_t_3;
+    __pyx_t_3 = 0;
 
-    /* "pysam/csamtools.pyx":2925
+    /* "csamtools.pyx":2925
  *             l = cigar_p[k] >> BAM_CIGAR_SHIFT
  * 
  *             if op == BAM_CMATCH:             # <<<<<<<<<<<<<<
  *                 o = min( pos + l, end) - max( pos, start )
  *                 if o > 0: overlap += o
  */
-    __pyx_t_2 = (__pyx_v_op == 0);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_v_op == 0);
+    if (__pyx_t_1) {
 
-      /* "pysam/csamtools.pyx":2926
+      /* "csamtools.pyx":2926
  * 
  *             if op == BAM_CMATCH:
  *                 o = min( pos + l, end) - max( pos, start )             # <<<<<<<<<<<<<<
  *                 if o > 0: overlap += o
  * 
  */
-      __pyx_t_6 = __pyx_v_end;
-      __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_v_end;
+      __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_v_l); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_8 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      if (__pyx_t_2) {
-        __pyx_t_9 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_5 = __pyx_t_9;
-        __pyx_t_9 = 0;
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      if (__pyx_t_1) {
+        __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_7);
+        __pyx_t_3 = __pyx_t_7;
+        __pyx_t_7 = 0;
       } else {
-        __Pyx_INCREF(__pyx_t_7);
-        __pyx_t_5 = __pyx_t_7;
+        __Pyx_INCREF(__pyx_t_5);
+        __pyx_t_3 = __pyx_t_5;
       }
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_6 = __pyx_v_start;
-      __pyx_t_10 = __pyx_v_pos;
-      if ((__pyx_t_6 > __pyx_t_10)) {
-        __pyx_t_11 = __pyx_t_6;
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_4 = __pyx_v_start;
+      __pyx_t_8 = __pyx_v_pos;
+      if ((__pyx_t_4 > __pyx_t_8)) {
+        __pyx_t_9 = __pyx_t_4;
       } else {
-        __pyx_t_11 = __pyx_t_10;
+        __pyx_t_9 = __pyx_t_8;
       }
-      __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_11); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_9 = PyNumber_Subtract(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_o = __pyx_t_12;
+      __pyx_v_o = __pyx_t_10;
 
-      /* "pysam/csamtools.pyx":2927
+      /* "csamtools.pyx":2927
  *             if op == BAM_CMATCH:
  *                 o = min( pos + l, end) - max( pos, start )
  *                 if o > 0: overlap += o             # <<<<<<<<<<<<<<
  * 
  *             if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
  */
-      __pyx_t_2 = (__pyx_v_o > 0);
-      if (__pyx_t_2) {
+      __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:;
 
-    /* "pysam/csamtools.pyx":2929
+    /* "csamtools.pyx":2929
  *                 if o > 0: overlap += o
  * 
  *             if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:             # <<<<<<<<<<<<<<
@@ -29617,26 +27535,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx
       case 2:
       case 3:
 
-      /* "pysam/csamtools.pyx":2930
+      /* "csamtools.pyx":2930
  * 
  *             if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
  *                 pos += l             # <<<<<<<<<<<<<<
  * 
  *         return overlap
  */
-      __pyx_t_9 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_9, __pyx_v_l); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_11 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_7); if (unlikely((__pyx_t_11 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_v_pos = __pyx_t_11;
+      __pyx_t_9 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_v_pos = __pyx_t_9;
       break;
     }
   }
 
-  /* "pysam/csamtools.pyx":2932
+  /* "csamtools.pyx":2932
  *                 pos += l
  * 
  *         return overlap             # <<<<<<<<<<<<<<
@@ -29644,20 +27562,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx
  *     def opt(self, tag):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_overlap); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_r = __pyx_t_7;
-  __pyx_t_7 = 0;
+  __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_overlap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.overlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.overlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_l);
@@ -29667,19 +27585,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_10overlap(struct __pyx
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_13opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_11AlignedRead_12opt[] = "AlignedRead.opt(self, tag)\nretrieves optional data given a two-letter *tag*";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_12opt(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tag));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2934
+/* "csamtools.pyx":2934
  *         return overlap
  * 
  *     def opt(self, tag):             # <<<<<<<<<<<<<<
@@ -29687,12 +27593,14 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_13opt(PyObject *__pyx_
  *         #see bam_aux.c: bam_aux_get() and bam_aux2i() etc
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj_5pysam_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
@@ -29713,22 +27621,22 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
   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);
 
-  /* "pysam/csamtools.pyx":2939
+  /* "csamtools.pyx":2939
  *         cdef uint8_t * v
  *         cdef int nvalues
  *         btag = _force_bytes(tag)             # <<<<<<<<<<<<<<
  *         v = bam_aux_get(self._delegate, btag)
  *         if v == NULL: raise KeyError( "tag '%s' not present" % tag )
  */
-  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_bytes(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_v_btag = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":2940
+  /* "csamtools.pyx":2940
  *         cdef int nvalues
  *         btag = _force_bytes(tag)
  *         v = bam_aux_get(self._delegate, btag)             # <<<<<<<<<<<<<<
@@ -29736,9 +27644,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
  *         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);
 
-  /* "pysam/csamtools.pyx":2941
+  /* "csamtools.pyx":2941
  *         btag = _force_bytes(tag)
  *         v = bam_aux_get(self._delegate, btag)
  *         if v == NULL: raise KeyError( "tag '%s' not present" % tag )             # <<<<<<<<<<<<<<
@@ -29750,7 +27658,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __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;
@@ -29760,11 +27668,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(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 = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L3;
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":2942
+  /* "csamtools.pyx":2942
  *         v = bam_aux_get(self._delegate, btag)
  *         if v == NULL: raise KeyError( "tag '%s' not present" % tag )
  *         auxtype = chr(v[0])             # <<<<<<<<<<<<<<
@@ -29774,7 +27682,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
   __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;
@@ -29784,28 +27692,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
   __pyx_v_auxtype = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":2943
+  /* "csamtools.pyx":2943
  *         if v == NULL: raise KeyError( "tag '%s' not present" % tag )
  *         auxtype = chr(v[0])
  *         if auxtype == 'c' or auxtype == 'C' or auxtype == 's' or auxtype == 'S':             # <<<<<<<<<<<<<<
  *             return <int>bam_aux2i(v)
  *         elif auxtype == 'i' or auxtype == 'I':
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__c), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__c), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!__pyx_t_3) {
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__C), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__C), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (!__pyx_t_5) {
-      __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__s), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __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 = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__s), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_6) {
-        __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__S), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __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 = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_7 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_8 = __pyx_t_7;
       } else {
         __pyx_t_8 = __pyx_t_6;
@@ -29820,7 +27720,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
   }
   if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2944
+    /* "csamtools.pyx":2944
  *         auxtype = chr(v[0])
  *         if auxtype == 'c' or auxtype == 'C' or auxtype == 's' or auxtype == 'S':
  *             return <int>bam_aux2i(v)             # <<<<<<<<<<<<<<
@@ -29833,30 +27733,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
-  /* "pysam/csamtools.pyx":2945
+  /* "csamtools.pyx":2945
  *         if auxtype == 'c' or auxtype == 'C' or auxtype == 's' or auxtype == 'S':
  *             return <int>bam_aux2i(v)
  *         elif auxtype == 'i' or auxtype == 'I':             # <<<<<<<<<<<<<<
  *             return <int32_t>bam_aux2i(v)
  *         elif auxtype == 'f' or auxtype == 'F':
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__i), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!__pyx_t_5) {
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__I), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__I), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_6 = __pyx_t_3;
   } else {
     __pyx_t_6 = __pyx_t_5;
   }
   if (__pyx_t_6) {
 
-    /* "pysam/csamtools.pyx":2946
+    /* "csamtools.pyx":2946
  *             return <int>bam_aux2i(v)
  *         elif auxtype == 'i' or auxtype == 'I':
  *             return <int32_t>bam_aux2i(v)             # <<<<<<<<<<<<<<
@@ -29869,30 +27765,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
-  /* "pysam/csamtools.pyx":2947
+  /* "csamtools.pyx":2947
  *         elif auxtype == 'i' or auxtype == 'I':
  *             return <int32_t>bam_aux2i(v)
  *         elif auxtype == 'f' or auxtype == 'F':             # <<<<<<<<<<<<<<
  *             return <float>bam_aux2f(v)
  *         elif auxtype == 'd' or auxtype == 'D':
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__f), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __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 = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__f), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!__pyx_t_6) {
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__F), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__F), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = __pyx_t_5;
   } else {
     __pyx_t_3 = __pyx_t_6;
   }
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":2948
+    /* "csamtools.pyx":2948
  *             return <int32_t>bam_aux2i(v)
  *         elif auxtype == 'f' or auxtype == 'F':
  *             return <float>bam_aux2f(v)             # <<<<<<<<<<<<<<
@@ -29905,30 +27797,26 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
-  /* "pysam/csamtools.pyx":2949
+  /* "csamtools.pyx":2949
  *         elif auxtype == 'f' or auxtype == 'F':
  *             return <float>bam_aux2f(v)
  *         elif auxtype == 'd' or auxtype == 'D':             # <<<<<<<<<<<<<<
  *             return <double>bam_aux2d(v)
  *         elif auxtype == 'A':
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__d), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__d), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!__pyx_t_3) {
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__D), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __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 = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_5 = __pyx_t_6;
   } else {
     __pyx_t_5 = __pyx_t_3;
   }
   if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2950
+    /* "csamtools.pyx":2950
  *             return <float>bam_aux2f(v)
  *         elif auxtype == 'd' or auxtype == 'D':
  *             return <double>bam_aux2d(v)             # <<<<<<<<<<<<<<
@@ -29941,22 +27829,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __pyx_r = __pyx_t_1;
     __pyx_t_1 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
-  /* "pysam/csamtools.pyx":2951
+  /* "csamtools.pyx":2951
  *         elif auxtype == 'd' or auxtype == 'D':
  *             return <double>bam_aux2d(v)
  *         elif auxtype == 'A':             # <<<<<<<<<<<<<<
  *             # there might a more efficient way
  *             # to convert a char into a string
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__A), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2954
+    /* "csamtools.pyx":2954
  *             # there might a more efficient way
  *             # to convert a char into a string
  *             return '%c' % <char>bam_aux2A(v)             # <<<<<<<<<<<<<<
@@ -29972,22 +27858,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __pyx_r = ((PyObject *)__pyx_t_4);
     __pyx_t_4 = 0;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
 
-  /* "pysam/csamtools.pyx":2955
+  /* "csamtools.pyx":2955
  *             # to convert a char into a string
  *             return '%c' % <char>bam_aux2A(v)
  *         elif auxtype == 'Z':             # <<<<<<<<<<<<<<
  *             return _charptr_to_str(<char*>bam_aux2Z(v))
  *         elif auxtype == 'B':
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__Z), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__Z), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2956
+    /* "csamtools.pyx":2956
  *             return '%c' % <char>bam_aux2A(v)
  *         elif auxtype == 'Z':
  *             return _charptr_to_str(<char*>bam_aux2Z(v))             # <<<<<<<<<<<<<<
@@ -29995,53 +27879,50 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
  *             bytesize, nvalues, values = convertBinaryTagToList( v + 1 )
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_4 = __pyx_f_5pysam_9csamtools__charptr_to_str(((char *)bam_aux2Z(__pyx_v_v))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __pyx_f_9csamtools__charptr_to_str(((char *)bam_aux2Z(__pyx_v_v))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __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_L4;
+    goto __pyx_L6;
   }
 
-  /* "pysam/csamtools.pyx":2957
+  /* "csamtools.pyx":2957
  *         elif auxtype == 'Z':
  *             return _charptr_to_str(<char*>bam_aux2Z(v))
  *         elif auxtype == 'B':             # <<<<<<<<<<<<<<
  *             bytesize, nvalues, values = convertBinaryTagToList( v + 1 )
  *             return values
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__B), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__B), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":2958
+    /* "csamtools.pyx":2958
  *             return _charptr_to_str(<char*>bam_aux2Z(v))
  *         elif auxtype == 'B':
  *             bytesize, nvalues, values = convertBinaryTagToList( v + 1 )             # <<<<<<<<<<<<<<
  *             return values
  *         else:
  */
-    __pyx_t_4 = __pyx_f_5pysam_9csamtools_convertBinaryTagToList((__pyx_v_v + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __pyx_f_9csamtools_convertBinaryTagToList((__pyx_v_v + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
       PyObject* sequence = __pyx_t_4;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 3)) {
-        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
+          if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
         __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); 
       } else {
+        if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
+          if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
         __pyx_t_10 = PyList_GET_ITEM(sequence, 2); 
@@ -30049,35 +27930,28 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
       __Pyx_INCREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_t_10);
-      #else
-      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    } else
-    {
+    } else {
       Py_ssize_t index = -1;
       __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __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_t_12 = NULL;
       __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;
-      __pyx_t_12 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      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;
@@ -30087,7 +27961,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __pyx_v_values = __pyx_t_10;
     __pyx_t_10 = 0;
 
-    /* "pysam/csamtools.pyx":2959
+    /* "csamtools.pyx":2959
  *         elif auxtype == 'B':
  *             bytesize, nvalues, values = convertBinaryTagToList( v + 1 )
  *             return values             # <<<<<<<<<<<<<<
@@ -30098,11 +27972,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __Pyx_INCREF(__pyx_v_values);
     __pyx_r = __pyx_v_values;
     goto __pyx_L0;
-    goto __pyx_L4;
+    goto __pyx_L6;
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":2961
+    /* "csamtools.pyx":2961
  *             return values
  *         else:
  *             raise ValueError("unknown auxilliary type '%s'" % auxtype)             # <<<<<<<<<<<<<<
@@ -30112,7 +27986,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __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;
@@ -30123,7 +27997,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
     __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;
@@ -30133,7 +28007,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.opt", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.opt", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_btag);
@@ -30146,19 +28020,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_12opt(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_15fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_11AlignedRead_14fancy_str[] = "AlignedRead.fancy_str(self)\nreturns list of fieldnames/values in pretty format for debugging\n        ";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_11AlignedRead_14fancy_str(((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":2964
+/* "csamtools.pyx":2964
  * 
  * 
  *     def fancy_str (self):             # <<<<<<<<<<<<<<
@@ -30166,7 +28028,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11AlignedRead_15fancy_str(PyObject *
  *         """
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_5pysam_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;
@@ -30188,10 +28052,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
   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);
 
-  /* "pysam/csamtools.pyx":2967
+  /* "csamtools.pyx":2967
  *         """returns list of fieldnames/values in pretty format for debugging
  *         """
  *         ret_string = []             # <<<<<<<<<<<<<<
@@ -30199,11 +28063,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
  *            "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;
 
-  /* "pysam/csamtools.pyx":2968
+  /* "csamtools.pyx":2968
  *         """
  *         ret_string = []
  *         field_names = {             # <<<<<<<<<<<<<<
@@ -30233,7 +28097,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
   __pyx_v_field_names = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":2988
+  /* "csamtools.pyx":2988
  *            "data_len":      "Current data length",
  *            }
  *         fields_names_in_order = ["tid", "pos", "mtid", "mpos", "isize", "flag",             # <<<<<<<<<<<<<<
@@ -30241,7 +28105,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
  *                                  "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));
@@ -30299,58 +28163,60 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
   __pyx_v_fields_names_in_order = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":2992
+  /* "csamtools.pyx":2992
  *                                  "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"]
  * 
  *         for f in fields_names_in_order:             # <<<<<<<<<<<<<<
  *             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;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #else
-    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #endif
+    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
     __Pyx_XDECREF(__pyx_v_f);
     __pyx_v_f = __pyx_t_3;
     __pyx_t_3 = 0;
 
-    /* "pysam/csamtools.pyx":2993
+    /* "csamtools.pyx":2993
  * 
  *         for f in fields_names_in_order:
  *             if not f in self.__dict__:             # <<<<<<<<<<<<<<
  *                 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 = (__Pyx_PySequence_Contains(__pyx_v_f, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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;
     __pyx_t_5 = (!__pyx_t_4);
     if (__pyx_t_5) {
 
-      /* "pysam/csamtools.pyx":2994
+      /* "csamtools.pyx":2994
  *         for f in fields_names_in_order:
  *             if not f in self.__dict__:
  *                 continue             # <<<<<<<<<<<<<<
  *             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:;
 
-    /* "pysam/csamtools.pyx":2995
+    /* "csamtools.pyx":2995
  *             if not f in self.__dict__:
  *                 continue
  *             ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))             # <<<<<<<<<<<<<<
  * 
  *         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;}
@@ -30358,10 +28224,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
     __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);
@@ -30370,7 +28236,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
     __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);
@@ -30385,18 +28251,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
     __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;
 
-  /* "pysam/csamtools.pyx":2997
+  /* "csamtools.pyx":2997
  *             ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
  * 
  *         for f in self.__dict__:             # <<<<<<<<<<<<<<
  *             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;
@@ -30408,20 +28274,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
   }
   __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;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_9)) {
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
+    } else if (PyTuple_CheckExact(__pyx_t_9)) {
       if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
     } else {
       __pyx_t_1 = __pyx_t_11(__pyx_t_9);
       if (unlikely(!__pyx_t_1)) {
@@ -30437,28 +28295,34 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
     __pyx_v_f = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":2998
+    /* "csamtools.pyx":2998
  * 
  *         for f in self.__dict__:
  *             if not f in field_names:             # <<<<<<<<<<<<<<
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
  *         return ret_string
  */
-    __pyx_t_5 = (__Pyx_PyDict_Contains(__pyx_v_f, ((PyObject *)__pyx_v_field_names), Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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) {
 
-      /* "pysam/csamtools.pyx":2999
+      /* "csamtools.pyx":2999
  *         for f in self.__dict__:
  *             if not f in field_names:
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))             # <<<<<<<<<<<<<<
  *         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);
@@ -30467,7 +28331,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
       __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);
@@ -30482,13 +28346,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
       __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;
 
-  /* "pysam/csamtools.pyx":3000
+  /* "csamtools.pyx":3000
  *             if not f in field_names:
  *                 ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
  *         return ret_string             # <<<<<<<<<<<<<<
@@ -30509,7 +28373,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_AddTraceback("pysam.csamtools.AlignedRead.fancy_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.AlignedRead.fancy_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_ret_string);
@@ -30522,21 +28386,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11AlignedRead_14fancy_str(struct __p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11PileupProxy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11PileupProxy___init__(((struct __pyx_obj_5pysam_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3019
+/* "csamtools.pyx":3019
  *     will change.
  *     '''
  *     def __init__(self):             # <<<<<<<<<<<<<<
@@ -30544,7 +28394,8 @@ static int __pyx_pw_5pysam_9csamtools_11PileupProxy_1__init__(PyObject *__pyx_v_
  * 
  */
 
-static int __pyx_pf_5pysam_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_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;
@@ -30552,10 +28403,13 @@ static int __pyx_pf_5pysam_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struc
   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;
 
-  /* "pysam/csamtools.pyx":3020
+  /* "csamtools.pyx":3020
  *     '''
  *     def __init__(self):
  *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
@@ -30572,7 +28426,7 @@ static int __pyx_pf_5pysam_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struc
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupProxy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupProxy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -30580,18 +28434,7 @@ static int __pyx_pf_5pysam_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3__str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3__str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(((struct __pyx_obj_5pysam_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3022
+/* "csamtools.pyx":3022
  *         raise TypeError("This class cannot be instantiated from Python")
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -30599,7 +28442,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3__str__(PyObject *__p
  *             "\n" +\
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_5pysam_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;
@@ -30611,10 +28455,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
   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);
 
-  /* "pysam/csamtools.pyx":3023
+  /* "csamtools.pyx":3023
  * 
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\             # <<<<<<<<<<<<<<
@@ -30623,7 +28467,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
  */
   __Pyx_XDECREF(__pyx_r);
 
-  /* "pysam/csamtools.pyx":3024
+  /* "csamtools.pyx":3024
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" +\             # <<<<<<<<<<<<<<
@@ -30633,21 +28477,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
   __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 = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "pysam/csamtools.pyx":3023
+  /* "csamtools.pyx":3023
  * 
  *     def __str__(self):
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\             # <<<<<<<<<<<<<<
  *             "\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);
@@ -30658,7 +28502,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
   __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))));
@@ -30669,7 +28513,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
   __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;
@@ -30681,7 +28525,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-  /* "pysam/csamtools.pyx":3025
+  /* "csamtools.pyx":3025
  *         return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
  *             "\n" +\
  *             "\n".join( map(str, self.pileups) )             # <<<<<<<<<<<<<<
@@ -30690,10 +28534,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
  */
   __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))));
@@ -30704,7 +28548,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
   __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;
@@ -30728,7 +28572,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("pysam.csamtools.PileupProxy.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupProxy.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -30737,18 +28581,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_2__str__(struct __pyx_
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3tid_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11PileupProxy_3tid___get__(((struct __pyx_obj_5pysam_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3029
+/* "csamtools.pyx":3029
  *     property tid:
  *         '''the chromosome ID as is defined in the header'''
  *         def __get__(self): return self.tid             # <<<<<<<<<<<<<<
@@ -30756,7 +28589,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3tid_1__get__(PyObject
  *     property n:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3tid___get__(struct __pyx_obj_5pysam_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;
@@ -30764,10 +28598,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3tid___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], 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;
@@ -30777,7 +28611,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3tid___get__(struct __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupProxy.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupProxy.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -30786,18 +28620,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3tid___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_1n_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_1n_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11PileupProxy_1n___get__(((struct __pyx_obj_5pysam_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3033
+/* "csamtools.pyx":3033
  *     property n:
  *         '''number of reads mapping to this column.'''
  *         def __get__(self): return self.n_pu             # <<<<<<<<<<<<<<
@@ -30805,7 +28628,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_1n_1__get__(PyObject *
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_1n___get__(struct __pyx_obj_5pysam_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;
@@ -30813,10 +28637,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_1n___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], 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;
@@ -30826,7 +28650,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_1n___get__(struct __py
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupProxy.n.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupProxy.n.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -30835,18 +28659,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_1n___get__(struct __py
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_11PileupProxy_1n_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_11PileupProxy_1n_2__set__(((struct __pyx_obj_5pysam_9csamtools_PileupProxy *)__pyx_v_self), ((PyObject *)__pyx_v_n));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3034
+/* "csamtools.pyx":3034
  *         '''number of reads mapping to this column.'''
  *         def __get__(self): return self.n_pu
  *         def __set__(self, n): self.n_pu = n             # <<<<<<<<<<<<<<
@@ -30854,7 +28667,8 @@ static int __pyx_pw_5pysam_9csamtools_11PileupProxy_1n_3__set__(PyObject *__pyx_
  *     property pos:
  */
 
-static int __pyx_pf_5pysam_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj_5pysam_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;
@@ -30862,15 +28676,15 @@ static int __pyx_pf_5pysam_9csamtools_11PileupProxy_1n_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], 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;
   __pyx_L1_error:;
-  __Pyx_AddTraceback("pysam.csamtools.PileupProxy.n.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupProxy.n.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -30878,18 +28692,7 @@ static int __pyx_pf_5pysam_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3pos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11PileupProxy_3pos___get__(((struct __pyx_obj_5pysam_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3037
+/* "csamtools.pyx":3037
  * 
  *     property pos:
  *         def __get__(self): return self.pos             # <<<<<<<<<<<<<<
@@ -30897,7 +28700,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_3pos_1__get__(PyObject
  *     property pileups:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3pos___get__(struct __pyx_obj_5pysam_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;
@@ -30905,10 +28709,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3pos___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], 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;
@@ -30918,7 +28722,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3pos___get__(struct __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupProxy.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupProxy.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -30927,18 +28731,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_3pos___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_7pileups_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_7pileups_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_11PileupProxy_7pileups___get__(((struct __pyx_obj_5pysam_9csamtools_PileupProxy *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3041
+/* "csamtools.pyx":3041
  *     property pileups:
  *         '''list of reads (:class:`pysam.PileupRead`) aligned to this column'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -30946,7 +28739,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_11PileupProxy_7pileups_1__get__(PyOb
  *             pileups = []
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_7pileups___get__(struct __pyx_obj_5pysam_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;
@@ -30959,10 +28753,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_7pileups___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], 3041);
 
-  /* "pysam/csamtools.pyx":3043
+  /* "csamtools.pyx":3043
  *         def __get__(self):
  *             cdef int x
  *             pileups = []             # <<<<<<<<<<<<<<
@@ -30970,21 +28764,21 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_7pileups___get__(struc
  *             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;
 
-  /* "pysam/csamtools.pyx":3045
+  /* "csamtools.pyx":3045
  *             pileups = []
  * 
  *             if self.plp[0] == NULL:             # <<<<<<<<<<<<<<
  *                 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) {
 
-    /* "pysam/csamtools.pyx":3046
+    /* "csamtools.pyx":3046
  * 
  *             if self.plp[0] == NULL:
  *                 raise ValueError("PileupProxy accessed after iterator finished")             # <<<<<<<<<<<<<<
@@ -30996,34 +28790,37 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_7pileups___get__(struc
     __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:;
 
-  /* "pysam/csamtools.pyx":3050
+  /* "csamtools.pyx":3050
  *             # warning: there could be problems if self.n and self.buf are
  *             # out of sync.
  *             for x from 0 <= x < self.n_pu:             # <<<<<<<<<<<<<<
  *                 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++) {
 
-    /* "pysam/csamtools.pyx":3051
+    /* "csamtools.pyx":3051
  *             # out of sync.
  *             for x from 0 <= x < self.n_pu:
  *                 pileups.append( makePileupRead( &(self.plp[0][x])) )             # <<<<<<<<<<<<<<
  *             return pileups
  * 
  */
-    __pyx_t_1 = __pyx_f_5pysam_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;
   }
 
-  /* "pysam/csamtools.pyx":3052
+  /* "csamtools.pyx":3052
  *             for x from 0 <= x < self.n_pu:
  *                 pileups.append( makePileupRead( &(self.plp[0][x])) )
  *             return pileups             # <<<<<<<<<<<<<<
@@ -31039,7 +28836,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_7pileups___get__(struc
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupProxy.pileups.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupProxy.pileups.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_pileups);
@@ -31049,21 +28846,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_11PileupProxy_7pileups___get__(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_10PileupRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_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_5pysam_9csamtools_10PileupRead___init__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3058
+/* "csamtools.pyx":3058
  *     '''
  * 
  *     def __init__(self):             # <<<<<<<<<<<<<<
@@ -31071,7 +28854,8 @@ static int __pyx_pw_5pysam_9csamtools_10PileupRead_1__init__(PyObject *__pyx_v_s
  * 
  */
 
-static int __pyx_pf_5pysam_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_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;
@@ -31079,10 +28863,13 @@ static int __pyx_pf_5pysam_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct
   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;
 
-  /* "pysam/csamtools.pyx":3059
+  /* "csamtools.pyx":3059
  * 
  *     def __init__(self):
  *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
@@ -31099,7 +28886,7 @@ static int __pyx_pf_5pysam_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupRead.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupRead.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_TraceReturn(Py_None);
@@ -31107,18 +28894,7 @@ static int __pyx_pf_5pysam_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_3__str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_3__str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3061
+/* "csamtools.pyx":3061
  *         raise TypeError("This class cannot be instantiated from Python")
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -31126,7 +28902,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_3__str__(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(struct __pyx_obj_5pysam_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;
@@ -31142,10 +28919,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(struct __pyx_o
   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);
 
-  /* "pysam/csamtools.pyx":3062
+  /* "csamtools.pyx":3062
  * 
  *     def __str__(self):
  *         return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) )             # <<<<<<<<<<<<<<
@@ -31155,22 +28932,22 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(struct __pyx_o
   __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);
@@ -31193,7 +28970,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(struct __pyx_o
   __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))));
@@ -31204,7 +28981,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(struct __pyx_o
   __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;
@@ -31228,7 +29005,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(struct __pyx_o
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_AddTraceback("pysam.csamtools.PileupRead.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupRead.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -31237,18 +29014,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_2__str__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_9alignment_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_9alignment_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_10PileupRead_9alignment___get__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3066
+/* "csamtools.pyx":3066
  *     property alignment:
  *         """a :class:`pysam.AlignedRead` object of the aligned read"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -31256,14 +29022,15 @@ static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_9alignment_1__get__(PyO
  *     property qpos:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_9alignment___get__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":3067
+  /* "csamtools.pyx":3067
  *         """a :class:`pysam.AlignedRead` object of the aligned read"""
  *         def __get__(self):
  *             return self._alignment             # <<<<<<<<<<<<<<
@@ -31271,8 +29038,8 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_9alignment___get__(stru
  *         """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);
@@ -31283,18 +29050,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_9alignment___get__(stru
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_4qpos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_4qpos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_10PileupRead_4qpos___get__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3070
+/* "csamtools.pyx":3070
  *     property qpos:
  *         """position of the read base at the pileup site, 0-based"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -31302,7 +29058,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_4qpos_1__get__(PyObject
  *     property indel:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj_5pysam_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;
@@ -31310,10 +29067,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_4qpos___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], 3070);
 
-  /* "pysam/csamtools.pyx":3071
+  /* "csamtools.pyx":3071
  *         """position of the read base at the pileup site, 0-based"""
  *         def __get__(self):
  *             return self._qpos             # <<<<<<<<<<<<<<
@@ -31321,7 +29078,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_4qpos___get__(struct __
  *         """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;
@@ -31331,7 +29088,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_4qpos___get__(struct __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupRead.qpos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupRead.qpos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -31340,18 +29097,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_4qpos___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_5indel_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_5indel_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_10PileupRead_5indel___get__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3074
+/* "csamtools.pyx":3074
  *     property indel:
  *         """indel length; 0 for no indel, positive for ins and negative for del"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -31359,7 +29105,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_5indel_1__get__(PyObjec
  *     property is_del:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5indel___get__(struct __pyx_obj_5pysam_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;
@@ -31367,10 +29114,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5indel___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], 3074);
 
-  /* "pysam/csamtools.pyx":3075
+  /* "csamtools.pyx":3075
  *         """indel length; 0 for no indel, positive for ins and negative for del"""
  *         def __get__(self):
  *             return self._indel             # <<<<<<<<<<<<<<
@@ -31378,7 +29125,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5indel___get__(struct _
  *         """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;
@@ -31388,7 +29135,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5indel___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupRead.indel.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupRead.indel.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -31397,18 +29144,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5indel___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_6is_del_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_10PileupRead_6is_del___get__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3078
+/* "csamtools.pyx":3078
  *     property is_del:
  *         """1 iff the base on the padded read is a deletion"""
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -31416,7 +29152,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_6is_del_1__get__(PyObje
  *     property is_head:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_6is_del___get__(struct __pyx_obj_5pysam_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;
@@ -31424,10 +29161,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_6is_del___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], 3078);
 
-  /* "pysam/csamtools.pyx":3079
+  /* "csamtools.pyx":3079
  *         """1 iff the base on the padded read is a deletion"""
  *         def __get__(self):
  *             return self._is_del             # <<<<<<<<<<<<<<
@@ -31435,7 +29172,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_6is_del___get__(struct
  *         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;
@@ -31445,7 +29182,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_6is_del___get__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupRead.is_del.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupRead.is_del.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -31454,18 +29191,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_6is_del___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_7is_head_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_10PileupRead_7is_head___get__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3081
+/* "csamtools.pyx":3081
  *             return self._is_del
  *     property is_head:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -31473,7 +29199,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_7is_head_1__get__(PyObj
  *     property is_tail:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_head___get__(struct __pyx_obj_5pysam_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;
@@ -31481,10 +29208,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_head___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], 3081);
 
-  /* "pysam/csamtools.pyx":3082
+  /* "csamtools.pyx":3082
  *     property is_head:
  *         def __get__(self):
  *             return self._is_head             # <<<<<<<<<<<<<<
@@ -31492,7 +29219,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_head___get__(struct
  *         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;
@@ -31502,7 +29229,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_head___get__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupRead.is_head.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupRead.is_head.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -31511,18 +29238,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_head___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_7is_tail_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_10PileupRead_7is_tail___get__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3084
+/* "csamtools.pyx":3084
  *             return self._is_head
  *     property is_tail:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -31530,7 +29246,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_7is_tail_1__get__(PyObj
  *     property level:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_obj_5pysam_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;
@@ -31538,10 +29255,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_tail___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], 3084);
 
-  /* "pysam/csamtools.pyx":3085
+  /* "csamtools.pyx":3085
  *     property is_tail:
  *         def __get__(self):
  *             return self._is_tail             # <<<<<<<<<<<<<<
@@ -31549,7 +29266,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_tail___get__(struct
  *         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;
@@ -31559,7 +29276,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_tail___get__(struct
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupRead.is_tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupRead.is_tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -31568,18 +29285,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_7is_tail___get__(struct
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_5level_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_5level_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_10PileupRead_5level___get__(((struct __pyx_obj_5pysam_9csamtools_PileupRead *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3087
+/* "csamtools.pyx":3087
  *             return self._is_tail
  *     property level:
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -31587,7 +29293,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_10PileupRead_5level_1__get__(PyObjec
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5level___get__(struct __pyx_obj_5pysam_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;
@@ -31595,10 +29302,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5level___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], 3087);
 
-  /* "pysam/csamtools.pyx":3088
+  /* "csamtools.pyx":3088
  *     property level:
  *         def __get__(self):
  *             return self._level             # <<<<<<<<<<<<<<
@@ -31606,7 +29313,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5level___get__(struct _
  * 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;
@@ -31616,7 +29323,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5level___get__(struct _
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.PileupRead.level.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.PileupRead.level.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -31625,33 +29332,47 @@ static PyObject *__pyx_pf_5pysam_9csamtools_10PileupRead_5level___get__(struct _
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_4Outs___init__[] = "Outs.__init__(self, id=1)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_4Outs_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_4Outs_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_4Outs___init__)};
-static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "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___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;
-  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;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__id,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -31660,7 +29381,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_1__init__(PyObject *__pyx_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 = 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)) {
@@ -31677,35 +29398,12 @@ static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_1__init__(PyObject *__pyx_self
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Outs.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_4Outs___init__(__pyx_self, __pyx_v_self, __pyx_v_id);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/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_5pysam_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);
 
-  /* "pysam/csamtools.pyx":3093
+  /* "csamtools.pyx":3093
  *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
  *     def __init__(self, id = 1):
  *         self.streams = []             # <<<<<<<<<<<<<<
@@ -31713,11 +29411,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs___init__(CYTHON_UNUSED PyObjec
  * 
  */
   __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;
 
-  /* "pysam/csamtools.pyx":3094
+  /* "csamtools.pyx":3094
  *     def __init__(self, id = 1):
  *         self.streams = []
  *         self.id = id             # <<<<<<<<<<<<<<
@@ -31730,7 +29428,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs___init__(CYTHON_UNUSED PyObjec
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.Outs.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -31739,41 +29437,59 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs___init__(CYTHON_UNUSED PyObjec
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_3setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_4Outs_2setdevice[] = "Outs.setdevice(self, filename)\nopen an existing file, like \"/dev/null\"";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_4Outs_3setdevice = {__Pyx_NAMESTR("setdevice"), (PyCFunction)__pyx_pw_5pysam_9csamtools_4Outs_3setdevice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_4Outs_2setdevice)};
-static PyObject *__pyx_pw_5pysam_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;
-  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;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       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;
@@ -31788,38 +29504,12 @@ static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_3setdevice(PyObject *__pyx_sel
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Outs.setdevice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.setdevice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_4Outs_2setdevice(__pyx_self, __pyx_v_self, __pyx_v_filename);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/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_5pysam_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);
-
-  /* "pysam/csamtools.pyx":3098
+  /* "csamtools.pyx":3098
  *     def setdevice(self, filename):
  *         '''open an existing file, like "/dev/null"'''
  *         fd = os.open(filename, os.O_WRONLY)             # <<<<<<<<<<<<<<
@@ -31837,7 +29527,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObj
   __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);
@@ -31851,7 +29541,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObj
   __pyx_v_fd = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":3099
+  /* "csamtools.pyx":3099
  *         '''open an existing file, like "/dev/null"'''
  *         fd = os.open(filename, os.O_WRONLY)
  *         self.setfd(fd)             # <<<<<<<<<<<<<<
@@ -31861,7 +29551,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObj
   __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);
@@ -31877,7 +29567,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObj
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.Outs.setdevice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.setdevice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_fd);
@@ -31887,41 +29577,60 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObj
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_5setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_4Outs_4setfile[] = "Outs.setfile(self, filename)\nopen a new file.";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_4Outs_5setfile = {__Pyx_NAMESTR("setfile"), (PyCFunction)__pyx_pw_5pysam_9csamtools_4Outs_5setfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_4Outs_4setfile)};
-static PyObject *__pyx_pw_5pysam_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;
-  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;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       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;
@@ -31936,39 +29645,12 @@ static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_5setfile(PyObject *__pyx_self,
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Outs.setfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.setfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_4Outs_4setfile(__pyx_self, __pyx_v_self, __pyx_v_filename);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/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_5pysam_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);
-
-  /* "pysam/csamtools.pyx":3103
+  /* "csamtools.pyx":3103
  *     def setfile(self, filename):
  *         '''open a new file.'''
  *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);             # <<<<<<<<<<<<<<
@@ -31995,7 +29677,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObjec
   __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);
@@ -32012,7 +29694,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObjec
   __pyx_v_fd = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":3104
+  /* "csamtools.pyx":3104
  *         '''open a new file.'''
  *         fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
  *         self.setfd(fd)             # <<<<<<<<<<<<<<
@@ -32022,7 +29704,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObjec
   __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);
@@ -32039,7 +29721,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObjec
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.Outs.setfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.setfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_fd);
@@ -32049,41 +29731,59 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObjec
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_7setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_4Outs_6setfd[] = "Outs.setfd(self, fd)";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_4Outs_7setfd = {__Pyx_NAMESTR("setfd"), (PyCFunction)__pyx_pw_5pysam_9csamtools_4Outs_7setfd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_4Outs_6setfd)};
-static PyObject *__pyx_pw_5pysam_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;
-  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;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fd,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
       }
       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;
@@ -32098,38 +29798,12 @@ static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_7setfd(PyObject *__pyx_self, P
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.Outs.setfd", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.setfd", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools_4Outs_6setfd(__pyx_self, __pyx_v_self, __pyx_v_fd);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/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_5pysam_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);
 
-  /* "pysam/csamtools.pyx":3107
+  /* "csamtools.pyx":3107
  * 
  *     def setfd(self, fd):
  *         ofd = os.dup(self.id)      #  Save old stream on new unit.             # <<<<<<<<<<<<<<
@@ -32144,7 +29818,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __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;
@@ -32155,7 +29829,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __pyx_v_ofd = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":3108
+  /* "csamtools.pyx":3108
  *     def setfd(self, fd):
  *         ofd = os.dup(self.id)      #  Save old stream on new unit.
  *         self.streams.append(ofd)             # <<<<<<<<<<<<<<
@@ -32169,7 +29843,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":3109
+  /* "csamtools.pyx":3109
  *         ofd = os.dup(self.id)      #  Save old stream on new unit.
  *         self.streams.append(ofd)
  *         sys.stdout.flush()          #  Buffered data goes to old stream.             # <<<<<<<<<<<<<<
@@ -32189,7 +29863,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":3110
+  /* "csamtools.pyx":3110
  *         self.streams.append(ofd)
  *         sys.stdout.flush()          #  Buffered data goes to old stream.
  *         sys.stderr.flush()          #  Buffered data goes to old stream.             # <<<<<<<<<<<<<<
@@ -32209,7 +29883,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":3111
+  /* "csamtools.pyx":3111
  *         sys.stdout.flush()          #  Buffered data goes to old stream.
  *         sys.stderr.flush()          #  Buffered data goes to old stream.
  *         os.dup2(fd, self.id)        #  Open unit 1 on new stream.             # <<<<<<<<<<<<<<
@@ -32224,7 +29898,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __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);
@@ -32237,7 +29911,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":3112
+  /* "csamtools.pyx":3112
  *         sys.stderr.flush()          #  Buffered data goes to old stream.
  *         os.dup2(fd, self.id)        #  Open unit 1 on new stream.
  *         os.close(fd)                #  Close other unit (look out, caller.)             # <<<<<<<<<<<<<<
@@ -32250,7 +29924,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __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);
@@ -32266,7 +29940,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.Outs.setfd", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.setfd", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_ofd);
@@ -32276,20 +29950,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_9restore(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_4Outs_8restore[] = "Outs.restore(self)\nrestore previous output stream";
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_4Outs_9restore = {__Pyx_NAMESTR("restore"), (PyCFunction)__pyx_pw_5pysam_9csamtools_4Outs_9restore, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_4Outs_8restore)};
-static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_9restore(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("restore (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_4Outs_8restore(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3114
+/* "csamtools.pyx":3114
  *         os.close(fd)                #  Close other unit (look out, caller.)
  * 
  *     def restore(self):             # <<<<<<<<<<<<<<
@@ -32297,7 +29958,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_4Outs_9restore(PyObject *__pyx_self,
  *         if self.streams:
  */
 
-static PyObject *__pyx_pf_5pysam_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;
@@ -32309,10 +29973,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
   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;
 
-  /* "pysam/csamtools.pyx":3116
+  /* "csamtools.pyx":3116
  *     def restore(self):
  *         '''restore previous output stream'''
  *         if self.streams:             # <<<<<<<<<<<<<<
@@ -32325,7 +29990,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "pysam/csamtools.pyx":3119
+    /* "csamtools.pyx":3119
  *             # the following was not sufficient, hence flush both stderr and stdout
  *             # os.fsync( self.id )
  *             sys.stdout.flush()             # <<<<<<<<<<<<<<
@@ -32345,7 +30010,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "pysam/csamtools.pyx":3120
+    /* "csamtools.pyx":3120
  *             # os.fsync( self.id )
  *             sys.stdout.flush()
  *             sys.stderr.flush()             # <<<<<<<<<<<<<<
@@ -32365,7 +30030,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":3121
+    /* "csamtools.pyx":3121
  *             sys.stdout.flush()
  *             sys.stderr.flush()
  *             os.dup2(self.streams[-1], self.id)             # <<<<<<<<<<<<<<
@@ -32385,7 +30050,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
     __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);
@@ -32398,7 +30063,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":3122
+    /* "csamtools.pyx":3122
  *             sys.stderr.flush()
  *             os.dup2(self.streams[-1], self.id)
  *             os.close(self.streams[-1])             # <<<<<<<<<<<<<<
@@ -32416,7 +30081,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
     __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;
@@ -32426,7 +30091,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "pysam/csamtools.pyx":3123
+    /* "csamtools.pyx":3123
  *             os.dup2(self.streams[-1], self.id)
  *             os.close(self.streams[-1])
  *             del self.streams[-1]             # <<<<<<<<<<<<<<
@@ -32437,9 +30102,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
     __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;
@@ -32448,7 +30113,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_AddTraceback("pysam.csamtools.Outs.restore", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.Outs.restore", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -32457,22 +30122,70 @@ static PyObject *__pyx_pf_5pysam_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObjec
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_5pysam_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 st [...]
-static PyMethodDef __pyx_mdef_5pysam_9csamtools_1_samtools_dispatch = {__Pyx_NAMESTR("_samtools_dispatch"), (PyCFunction)__pyx_pw_5pysam_9csamtools_1_samtools_dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools__samtools_dispatch)};
-static PyObject *__pyx_pw_5pysam_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+/* "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__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;
-  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;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__method,&__pyx_n_s__args,&__pyx_n_s__catch_stdout,0};
     PyObject* values[3] = {0,0,0};
 
-    /* "pysam/csamtools.pyx":3126
+    /* "csamtools.pyx":3126
  * 
  * def _samtools_dispatch( method,
  *                         args = (),             # <<<<<<<<<<<<<<
@@ -32483,8 +30196,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_1_samtools_dispatch(PyObject *__pyx_
     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);
@@ -32492,9 +30204,10 @@ static PyObject *__pyx_pw_5pysam_9csamtools_1_samtools_dispatch(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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -32508,7 +30221,7 @@ static PyObject *__pyx_pw_5pysam_9csamtools_1_samtools_dispatch(PyObject *__pyx_
         }
       }
       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)) {
@@ -32527,115 +30240,56 @@ static PyObject *__pyx_pw_5pysam_9csamtools_1_samtools_dispatch(PyObject *__pyx_
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("_samtools_dispatch", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_5pysam_9csamtools__samtools_dispatch(__pyx_self, __pyx_v_method, __pyx_v_args, __pyx_v_catch_stdout);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3125
- *             del self.streams[-1]
- * 
- * def _samtools_dispatch( method,             # <<<<<<<<<<<<<<
- *                         args = (),
- *                         catch_stdout = True ):
- */
-
-static PyObject *__pyx_pf_5pysam_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
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
-  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);
 
-  /* "pysam/csamtools.pyx":3151
+  /* "csamtools.pyx":3151
  * 
  *     # some special cases
  *     if method == "index":             # <<<<<<<<<<<<<<
  *         if not os.path.exists( args[0] ):
  *             raise IOError( "No such file or directory: '%s'" % args[0] )
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__index), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_1 = __Pyx_PyString_Equals(__pyx_v_method, ((PyObject *)__pyx_n_s__index), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_1) {
 
-    /* "pysam/csamtools.pyx":3152
+    /* "csamtools.pyx":3152
  *     # some special cases
  *     if method == "index":
  *         if not os.path.exists( args[0] ):             # <<<<<<<<<<<<<<
  *             raise IOError( "No such file or directory: '%s'" % args[0] )
  * 
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __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 = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __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;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_5 = (!__pyx_t_2);
+    __pyx_t_5 = (!__pyx_t_1);
     if (__pyx_t_5) {
 
-      /* "pysam/csamtools.pyx":3153
+      /* "csamtools.pyx":3153
  *     if method == "index":
  *         if not os.path.exists( args[0] ):
  *             raise IOError( "No such file or directory: '%s'" % args[0] )             # <<<<<<<<<<<<<<
@@ -32648,7 +30302,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
       __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;
@@ -32658,14 +30312,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
       __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:;
 
-  /* "pysam/csamtools.pyx":3156
+  /* "csamtools.pyx":3156
  * 
  *     # redirect stderr and stdout to file
  *     stderr_h, stderr_f = tempfile.mkstemp()             # <<<<<<<<<<<<<<
@@ -32682,59 +30336,52 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
     PyObject* sequence = __pyx_t_4;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    Py_ssize_t size = Py_SIZE(sequence);
-    #else
-    Py_ssize_t size = PySequence_Size(sequence);
-    #endif
-    if (unlikely(size != 2)) {
-      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
+      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
+      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
     } else {
+      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
-      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
+      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
     }
     __Pyx_INCREF(__pyx_t_3);
-    __Pyx_INCREF(__pyx_t_1);
-    #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #endif
+    __Pyx_INCREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  } else
-  {
+  } else {
     Py_ssize_t index = -1;
     __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __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_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_1);
+    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_t_7 = NULL;
     __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;
-    __pyx_t_7 = NULL;
-    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+    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;
-  __pyx_v_stderr_f = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_stderr_f = __pyx_t_2;
+  __pyx_t_2 = 0;
 
-  /* "pysam/csamtools.pyx":3157
+  /* "csamtools.pyx":3157
  *     # redirect stderr and stdout to file
  *     stderr_h, stderr_f = tempfile.mkstemp()
  *     pysam_set_stderr( stderr_h )             # <<<<<<<<<<<<<<
@@ -32744,7 +30391,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
   __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_stderr_h); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   pysam_set_stderr(__pyx_t_8);
 
-  /* "pysam/csamtools.pyx":3159
+  /* "csamtools.pyx":3159
  *     pysam_set_stderr( stderr_h )
  * 
  *     if catch_stdout:             # <<<<<<<<<<<<<<
@@ -32754,7 +30401,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_5) {
 
-    /* "pysam/csamtools.pyx":3160
+    /* "csamtools.pyx":3160
  * 
  *     if catch_stdout:
  *         stdout_h, stdout_f = tempfile.mkstemp()             # <<<<<<<<<<<<<<
@@ -32763,67 +30410,60 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
     __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
       PyObject* sequence = __pyx_t_4;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
-        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
-        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
+        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
       }
-      __Pyx_INCREF(__pyx_t_1);
+      __Pyx_INCREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_t_3);
-      #else
-      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    } else
-    {
+    } else {
       Py_ssize_t index = -1;
       __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __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_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
-      __Pyx_GOTREF(__pyx_t_1);
-      index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) 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_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_t_7 = NULL;
       __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;
-      __pyx_t_7 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      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_1;
-    __pyx_t_1 = 0;
+    __pyx_v_stdout_h = __pyx_t_2;
+    __pyx_t_2 = 0;
     __pyx_v_stdout_f = __pyx_t_3;
     __pyx_t_3 = 0;
 
-    /* "pysam/csamtools.pyx":3161
+    /* "csamtools.pyx":3161
  *     if catch_stdout:
  *         stdout_h, stdout_f = tempfile.mkstemp()
  *         try:             # <<<<<<<<<<<<<<
@@ -32837,69 +30477,69 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
       __Pyx_XGOTREF(__pyx_t_11);
       /*try:*/ {
 
-        /* "pysam/csamtools.pyx":3162
+        /* "csamtools.pyx":3162
  *         stdout_h, stdout_f = tempfile.mkstemp()
  *         try:
  *             stdout_save = Outs( sys.stdout.fileno() )             # <<<<<<<<<<<<<<
  *             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_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __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_1, __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_1); __pyx_t_1 = 0;
-        __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __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_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);
-        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
-        __pyx_t_1 = 0;
-        __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __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_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;
-        __pyx_v_stdout_save = __pyx_t_1;
-        __pyx_t_1 = 0;
+        __pyx_v_stdout_save = __pyx_t_2;
+        __pyx_t_2 = 0;
 
-        /* "pysam/csamtools.pyx":3163
+        /* "csamtools.pyx":3163
  *         try:
  *             stdout_save = Outs( sys.stdout.fileno() )
  *             stdout_save.setfd( stdout_h )             # <<<<<<<<<<<<<<
  *         except AttributeError:
  *             # stdout has already been redirected
  */
-        __pyx_t_1 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __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_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_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_1, ((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_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__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_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_1); __pyx_t_1 = 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;
 
-      /* "pysam/csamtools.pyx":3164
+      /* "csamtools.pyx":3164
  *             stdout_save = Outs( sys.stdout.fileno() )
  *             stdout_save.setfd( stdout_h )
  *         except AttributeError:             # <<<<<<<<<<<<<<
@@ -32908,102 +30548,100 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
       __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
       if (__pyx_t_8) {
-        __Pyx_AddTraceback("pysam.csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+        __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_L15_except_error;}
         __Pyx_GOTREF(__pyx_t_4);
         __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_2);
 
-        /* "pysam/csamtools.pyx":3166
+        /* "csamtools.pyx":3166
  *         except AttributeError:
  *             # stdout has already been redirected
  *             catch_stdout = False             # <<<<<<<<<<<<<<
  * 
  *         # 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;
         __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        goto __pyx_L11_exception_handled;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        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:;
     }
 
-    /* "pysam/csamtools.pyx":3171
+    /* "csamtools.pyx":3171
  *         # samtools `view` closes stdout, from which I can not
  *         # recover. Thus redirect output to file with -o option.
  *         if method == "view":             # <<<<<<<<<<<<<<
  *             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
  *             args = ( "-o", stdout_f ) + args
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__view), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_method, ((PyObject *)__pyx_n_s__view), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_5) {
 
-      /* "pysam/csamtools.pyx":3172
+      /* "csamtools.pyx":3172
  *         # recover. Thus redirect output to file with -o option.
  *         if method == "view":
  *             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")             # <<<<<<<<<<<<<<
  *             args = ( "-o", stdout_f ) + args
  * 
  */
-      __pyx_t_5 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_kp_s_178), __pyx_v_args, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = ((PySequence_Contains(__pyx_v_args, ((PyObject *)__pyx_kp_s_178)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_5) {
-        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_180), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_180), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __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 = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        goto __pyx_L21;
+        goto __pyx_L24;
       }
-      __pyx_L21:;
+      __pyx_L24:;
 
-      /* "pysam/csamtools.pyx":3173
+      /* "csamtools.pyx":3173
  *         if method == "view":
  *             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
  *             args = ( "-o", stdout_f ) + args             # <<<<<<<<<<<<<<
  * 
  *     # do the function call to samtools
  */
-      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3173; __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 = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
       __Pyx_INCREF(((PyObject *)__pyx_kp_s_178));
-      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_178));
+      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_178));
       __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_178));
       __Pyx_INCREF(__pyx_v_stdout_f);
-      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_stdout_f);
+      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_stdout_f);
       __Pyx_GIVEREF(__pyx_v_stdout_f);
-      __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_1), __pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_2), __pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3173; __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;
       __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:;
 
-  /* "pysam/csamtools.pyx":3179
+  /* "csamtools.pyx":3179
  *     cdef int i, n, retval
  * 
  *     n = len(args)             # <<<<<<<<<<<<<<
@@ -33013,20 +30651,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
   __pyx_t_12 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_n = __pyx_t_12;
 
-  /* "pysam/csamtools.pyx":3180
+  /* "csamtools.pyx":3180
  * 
  *     n = len(args)
  *     method = _force_cmdline_bytes(method)             # <<<<<<<<<<<<<<
  *     args = [ _force_cmdline_bytes(a) for a in args ]
  * 
  */
-  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_cmdline_bytes(__pyx_v_method)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = ((PyObject *)__pyx_f_9csamtools__force_cmdline_bytes(__pyx_v_method)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_v_method);
   __pyx_v_method = __pyx_t_3;
   __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":3181
+  /* "csamtools.pyx":3181
  *     n = len(args)
  *     method = _force_cmdline_bytes(method)
  *     args = [ _force_cmdline_bytes(a) for a in args ]             # <<<<<<<<<<<<<<
@@ -33034,32 +30672,24 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *     # 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_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
+    __pyx_t_2 = __pyx_v_args; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
     __pyx_t_13 = NULL;
   } else {
-    __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_args); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+    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 (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 {
-      __pyx_t_4 = __pyx_t_13(__pyx_t_1);
+      __pyx_t_4 = __pyx_t_13(__pyx_t_2);
       if (unlikely(!__pyx_t_4)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -33072,20 +30702,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
     __Pyx_XDECREF(__pyx_v_a);
     __pyx_v_a = __pyx_t_4;
     __pyx_t_4 = 0;
-    __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_9csamtools__force_cmdline_bytes(__pyx_v_a)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = ((PyObject *)__pyx_f_9csamtools__force_cmdline_bytes(__pyx_v_a)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = ((PyObject *)__pyx_t_3);
-  __Pyx_INCREF(__pyx_t_1);
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_INCREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(__pyx_v_args);
-  __pyx_v_args = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_v_args = ((PyObject *)__pyx_t_3);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
-  /* "pysam/csamtools.pyx":3184
+  /* "csamtools.pyx":3184
  * 
  *     # allocate two more for first (dummy) argument (contains command)
  *     cargs = <char**>calloc( n+2, sizeof( char *) )             # <<<<<<<<<<<<<<
@@ -33094,7 +30722,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
   __pyx_v_cargs = ((char **)calloc((__pyx_v_n + 2), (sizeof(char *))));
 
-  /* "pysam/csamtools.pyx":3185
+  /* "csamtools.pyx":3185
  *     # allocate two more for first (dummy) argument (contains command)
  *     cargs = <char**>calloc( n+2, sizeof( char *) )
  *     cargs[0] = "samtools"             # <<<<<<<<<<<<<<
@@ -33103,7 +30731,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
   (__pyx_v_cargs[0]) = __pyx_k__samtools;
 
-  /* "pysam/csamtools.pyx":3186
+  /* "csamtools.pyx":3186
  *     cargs = <char**>calloc( n+2, sizeof( char *) )
  *     cargs[0] = "samtools"
  *     cargs[1] = method             # <<<<<<<<<<<<<<
@@ -33113,7 +30741,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
   __pyx_t_14 = PyBytes_AsString(__pyx_v_method); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   (__pyx_v_cargs[1]) = __pyx_t_14;
 
-  /* "pysam/csamtools.pyx":3187
+  /* "csamtools.pyx":3187
  *     cargs[0] = "samtools"
  *     cargs[1] = method
  *     for i from 0 <= i < n: cargs[i+2] = args[i]             # <<<<<<<<<<<<<<
@@ -33122,14 +30750,14 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
   __pyx_t_8 = __pyx_v_n;
   for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {
-    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_14 = PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_14 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     (__pyx_v_cargs[(__pyx_v_i + 2)]) = __pyx_t_14;
   }
 
-  /* "pysam/csamtools.pyx":3189
+  /* "csamtools.pyx":3189
  *     for i from 0 <= i < n: cargs[i+2] = args[i]
  * 
  *     retval = pysam_dispatch(n+2, cargs)             # <<<<<<<<<<<<<<
@@ -33138,7 +30766,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
   __pyx_v_retval = pysam_dispatch((__pyx_v_n + 2), __pyx_v_cargs);
 
-  /* "pysam/csamtools.pyx":3190
+  /* "csamtools.pyx":3190
  * 
  *     retval = pysam_dispatch(n+2, cargs)
  *     free( cargs )             # <<<<<<<<<<<<<<
@@ -33147,7 +30775,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
   free(__pyx_v_cargs);
 
-  /* "pysam/csamtools.pyx":3194
+  /* "csamtools.pyx":3194
  *     # restore stdout/stderr. This will also flush, so
  *     # needs to be before reading back the file contents
  *     if catch_stdout:             # <<<<<<<<<<<<<<
@@ -33156,23 +30784,22 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
   __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;}
 
-    /* "pysam/csamtools.pyx":3195
+    /* "csamtools.pyx":3195
  *     # needs to be before reading back the file contents
  *     if catch_stdout:
  *         stdout_save.restore()             # <<<<<<<<<<<<<<
  *         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_1 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":3196
+    /* "csamtools.pyx":3196
  *     if catch_stdout:
  *         stdout_save.restore()
  *         try:             # <<<<<<<<<<<<<<
@@ -33186,7 +30813,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
       __Pyx_XGOTREF(__pyx_t_9);
       /*try:*/ {
 
-        /* "pysam/csamtools.pyx":3197
+        /* "csamtools.pyx":3197
  *         stdout_save.restore()
  *         try:
  *             with open( stdout_f, "r") as inf:             # <<<<<<<<<<<<<<
@@ -33194,26 +30821,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *         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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
-          __Pyx_GOTREF(__pyx_t_3);
+          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_3, 0, __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_3, 1, ((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_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
-          __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-          __pyx_t_15 = PyObject_GetAttr(__pyx_t_1, __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_GOTREF(__pyx_t_15);
-          __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L35_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_t_4 = PyObject_Call(__pyx_t_3, ((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(((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_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_L38_error;}
+          __Pyx_GOTREF(__pyx_t_2);
           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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);
@@ -33221,36 +30847,35 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
               __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;
 
-                /* "pysam/csamtools.pyx":3198
+                /* "csamtools.pyx":3198
  *         try:
  *             with open( stdout_f, "r") as inf:
  *                 out_stdout = inf.readlines()             # <<<<<<<<<<<<<<
  *         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_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3198; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
-                __Pyx_GOTREF(__pyx_t_1);
-                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-                __pyx_v_out_stdout = __pyx_t_1;
-                __pyx_t_1 = 0;
+                __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_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_3); __pyx_t_3 = 0;
               __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-              /* "pysam/csamtools.pyx":3197
+              /* "csamtools.pyx":3197
  *         stdout_save.restore()
  *         try:
  *             with open( stdout_f, "r") as inf:             # <<<<<<<<<<<<<<
@@ -33258,89 +30883,89 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *         except UnicodeDecodeError:
  */
               /*except:*/ {
-                __Pyx_AddTraceback("pysam.csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-                if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
-                __Pyx_GOTREF(__pyx_t_1);
-                __Pyx_GOTREF(__pyx_t_4);
+                __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+                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_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_INCREF(__pyx_t_1);
-                PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
-                __Pyx_GIVEREF(__pyx_t_1);
-                __Pyx_INCREF(__pyx_t_4);
-                PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
-                __Pyx_GIVEREF(__pyx_t_4);
+                __Pyx_GOTREF(__pyx_t_4);
+                __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, 2, __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, 2, __pyx_t_4);
+                __Pyx_GIVEREF(__pyx_t_4);
                 __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;}
-                __pyx_t_2 = (!__pyx_t_5);
-                if (__pyx_t_2) {
-                  __Pyx_GIVEREF(__pyx_t_1);
-                  __Pyx_GIVEREF(__pyx_t_4);
+                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_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_3);
-                  __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
-                  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
-                  goto __pyx_L52;
+                  __Pyx_GIVEREF(__pyx_t_4);
+                  __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_1); __pyx_t_1 = 0;
-                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-                goto __pyx_L42_exception_handled;
+                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                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_2 = __Pyx_PyObject_IsTrue(__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_2 < 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_1); __pyx_t_1 = 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;
+      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
 
-      /* "pysam/csamtools.pyx":3199
+      /* "csamtools.pyx":3199
  *             with open( stdout_f, "r") as inf:
  *                 out_stdout = inf.readlines()
  *         except UnicodeDecodeError:             # <<<<<<<<<<<<<<
@@ -33349,13 +30974,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
       __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
       if (__pyx_t_8) {
-        __Pyx_AddTraceback("pysam.csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3199; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
-        __Pyx_GOTREF(__pyx_t_3);
+        __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 = 3199; __pyx_clineno = __LINE__; goto __pyx_L32_except_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_GOTREF(__pyx_t_2);
 
-        /* "pysam/csamtools.pyx":3200
+        /* "csamtools.pyx":3200
  *                 out_stdout = inf.readlines()
  *         except UnicodeDecodeError:
  *             with open( stdout_f, "rb") as inf:             # <<<<<<<<<<<<<<
@@ -33363,25 +30988,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *                 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);
@@ -33389,37 +31014,35 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
               __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;
 
-                /* "pysam/csamtools.pyx":3202
+                /* "csamtools.pyx":3202
  *             with open( stdout_f, "rb") as inf:
  *                 # read binary output
  *                 out_stdout = inf.read()             # <<<<<<<<<<<<<<
  *         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;
 
-              /* "pysam/csamtools.pyx":3200
+              /* "csamtools.pyx":3200
  *                 out_stdout = inf.readlines()
  *         except UnicodeDecodeError:
  *             with open( stdout_f, "rb") as inf:             # <<<<<<<<<<<<<<
@@ -33427,137 +31050,137 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *                 out_stdout = inf.read()
  */
               /*except:*/ {
-                __Pyx_AddTraceback("pysam.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;}
+                __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+                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_2 = __Pyx_PyObject_IsTrue(__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_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
-                __pyx_t_5 = (!__pyx_t_2);
+                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_3); __pyx_t_3 = 0;
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        goto __pyx_L28_exception_handled;
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __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:;
     }
 
-    /* "pysam/csamtools.pyx":3203
+    /* "csamtools.pyx":3203
  *                 # read binary output
  *                 out_stdout = inf.read()
  *         os.remove( stdout_f )             # <<<<<<<<<<<<<<
  *     else:
  *         out_stdout = []
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __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_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __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_1, 0, __pyx_v_stdout_f);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stdout_f);
     __Pyx_GIVEREF(__pyx_v_stdout_f);
-    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); 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_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __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;
-    goto __pyx_L26;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    goto __pyx_L29;
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":3205
+    /* "csamtools.pyx":3205
  *         os.remove( stdout_f )
  *     else:
  *         out_stdout = []             # <<<<<<<<<<<<<<
  * 
  *     # get error messages
  */
-    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_v_out_stdout = ((PyObject *)__pyx_t_3);
-    __pyx_t_3 = 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:;
 
-  /* "pysam/csamtools.pyx":3208
+  /* "csamtools.pyx":3208
  * 
  *     # get error messages
  *     pysam_unset_stderr()             # <<<<<<<<<<<<<<
@@ -33566,7 +31189,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
   pysam_unset_stderr();
 
-  /* "pysam/csamtools.pyx":3209
+  /* "csamtools.pyx":3209
  *     # get error messages
  *     pysam_unset_stderr()
  *     try:             # <<<<<<<<<<<<<<
@@ -33580,7 +31203,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
     __Pyx_XGOTREF(__pyx_t_11);
     /*try:*/ {
 
-      /* "pysam/csamtools.pyx":3210
+      /* "csamtools.pyx":3210
  *     pysam_unset_stderr()
  *     try:
  *         with open( stderr_f, "r") as inf:             # <<<<<<<<<<<<<<
@@ -33588,25 +31211,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *     except UnicodeDecodeError:
  */
       /*with:*/ {
-        __pyx_t_3 = PyTuple_New(2); 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_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_3, 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_3, 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_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-        __pyx_t_15 = PyObject_GetAttr(__pyx_t_1, __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_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_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_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L83_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_4 = PyObject_Call(__pyx_t_3, ((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_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_3); __pyx_t_3 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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);
@@ -33614,40 +31237,39 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
             __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;
 
-              /* "pysam/csamtools.pyx":3211
+              /* "csamtools.pyx":3211
  *     try:
  *         with open( stderr_f, "r") as inf:
  *             out_stderr = inf.readlines()             # <<<<<<<<<<<<<<
  *     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_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3211; __pyx_clineno = __LINE__; goto __pyx_L89_error;}
-              __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __pyx_v_out_stderr = __pyx_t_1;
-              __pyx_t_1 = 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_1); __pyx_t_1 = 0;
 
-            /* "pysam/csamtools.pyx":3210
+            /* "csamtools.pyx":3210
  *     pysam_unset_stderr()
  *     try:
  *         with open( stderr_f, "r") as inf:             # <<<<<<<<<<<<<<
@@ -33655,89 +31277,89 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *     except UnicodeDecodeError:
  */
             /*except:*/ {
-              __Pyx_AddTraceback("pysam.csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-              if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
-              __Pyx_GOTREF(__pyx_t_1);
+              __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+              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_GOTREF(__pyx_t_3);
-              __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_1);
-              PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
-              __Pyx_GIVEREF(__pyx_t_1);
+              __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_21, 1, __pyx_t_2);
+              __Pyx_GIVEREF(__pyx_t_2);
               __Pyx_INCREF(__pyx_t_3);
-              PyTuple_SET_ITEM(__pyx_t_6, 2, __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_6, NULL);
+              __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;}
-              __pyx_t_2 = (!__pyx_t_5);
-              if (__pyx_t_2) {
-                __Pyx_GIVEREF(__pyx_t_1);
+              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_4);
+                __Pyx_GIVEREF(__pyx_t_2);
                 __Pyx_GIVEREF(__pyx_t_3);
-                __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_3);
-                __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; 
-                {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
+                __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_1); __pyx_t_1 = 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;
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              goto __pyx_L90_exception_handled;
+              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_2 = __Pyx_PyObject_IsTrue(__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_2 < 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:;
       }
     }
     /*else:*/ {
 
-      /* "pysam/csamtools.pyx":3218
+      /* "csamtools.pyx":3218
  *         os.remove( stderr_f )
  *     else:
  *         out_stderr = []             # <<<<<<<<<<<<<<
  * 
  *     return retval, out_stderr, out_stdout
  */
-      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
-      __Pyx_GOTREF(__pyx_t_3);
+      __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_3);
       __pyx_t_3 = 0;
@@ -33745,17 +31367,17 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
     __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_1); __pyx_t_1 = 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;
 
-    /* "pysam/csamtools.pyx":3212
+    /* "csamtools.pyx":3212
  *         with open( stderr_f, "r") as inf:
  *             out_stderr = inf.readlines()
  *     except UnicodeDecodeError:             # <<<<<<<<<<<<<<
@@ -33764,13 +31386,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  */
     __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
     if (__pyx_t_8) {
-      __Pyx_AddTraceback("pysam.csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3212; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
+      __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+      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_1);
 
-      /* "pysam/csamtools.pyx":3213
+      /* "csamtools.pyx":3213
  *             out_stderr = inf.readlines()
  *     except UnicodeDecodeError:
  *         with open( stderr_f, "rb") as inf:             # <<<<<<<<<<<<<<
@@ -33778,24 +31400,24 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *             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:*/ {
           {
@@ -33804,12 +31426,11 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
             __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;
 
-              /* "pysam/csamtools.pyx":3215
+              /* "csamtools.pyx":3215
  *         with open( stderr_f, "rb") as inf:
  *             # read binary output
  *             out_stderr = inf.read()             # <<<<<<<<<<<<<<
@@ -33835,7 +31456,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
             __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
             __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
 
-            /* "pysam/csamtools.pyx":3213
+            /* "csamtools.pyx":3213
  *             out_stderr = inf.readlines()
  *     except UnicodeDecodeError:
  *         with open( stderr_f, "rb") as inf:             # <<<<<<<<<<<<<<
@@ -33843,13 +31464,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  *             out_stderr = inf.read()
  */
             /*except:*/ {
-              __Pyx_AddTraceback("pysam.csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+              __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
               if (__Pyx_GetException(&__pyx_t_21, &__pyx_t_20, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
               __Pyx_GOTREF(__pyx_t_21);
               __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);
@@ -33863,10 +31484,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
               __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
               if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
               __Pyx_GOTREF(__pyx_t_19);
-              __pyx_t_2 = __Pyx_PyObject_IsTrue(__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_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
-              __pyx_t_5 = (!__pyx_t_2);
+              if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
+              __pyx_t_5 = (!__pyx_t_1);
               if (__pyx_t_5) {
                 __Pyx_GIVEREF(__pyx_t_21);
                 __Pyx_GIVEREF(__pyx_t_20);
@@ -33874,9 +31495,9 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
                 __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;
@@ -33888,7 +31509,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
             __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);
@@ -33901,62 +31522,62 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
           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:;
       }
 
-      /* "pysam/csamtools.pyx":3216
+      /* "csamtools.pyx":3216
  *             # read binary output
  *             out_stderr = inf.read()
  *         os.remove( stderr_f )             # <<<<<<<<<<<<<<
  *     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_1); __pyx_t_1 = 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:;
   }
 
-  /* "pysam/csamtools.pyx":3220
+  /* "csamtools.pyx":3220
  *         out_stderr = []
  * 
  *     return retval, out_stderr, out_stdout             # <<<<<<<<<<<<<<
@@ -33964,36 +31585,34 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
  * cdef class SNPCall:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  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_1);
-  __Pyx_GIVEREF(__pyx_t_1);
+  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_1 = 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);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_20);
   __Pyx_XDECREF(__pyx_t_21);
   __Pyx_XDECREF(__pyx_t_22);
-  __Pyx_AddTraceback("pysam.csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_stderr_h);
@@ -34014,18 +31633,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools__samtools_dispatch(CYTHON_UNUSED PyO
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_3tid_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7SNPCall_3tid___get__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3235
+/* "csamtools.pyx":3235
  *     property tid:
  *         '''the chromosome ID as is defined in the header'''
  *         def __get__(self):             # <<<<<<<<<<<<<<
@@ -34033,7 +31641,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_3tid_1__get__(PyObject *__p
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_5pysam_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;
@@ -34041,10 +31650,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3tid___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], 3235);
 
-  /* "pysam/csamtools.pyx":3236
+  /* "csamtools.pyx":3236
  *         '''the chromosome ID as is defined in the header'''
  *         def __get__(self):
  *             return self._tid             # <<<<<<<<<<<<<<
@@ -34052,7 +31661,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3tid___get__(struct __pyx_o
  *     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;
@@ -34062,7 +31671,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3tid___get__(struct __pyx_o
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34071,18 +31680,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3tid___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_3pos_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7SNPCall_3pos___get__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3240
+/* "csamtools.pyx":3240
  *     property pos:
  *        '''nucleotide position of SNP.'''
  *        def __get__(self): return self._pos             # <<<<<<<<<<<<<<
@@ -34090,7 +31688,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_3pos_1__get__(PyObject *__p
  *     property reference_base:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3pos___get__(struct __pyx_obj_5pysam_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;
@@ -34098,10 +31697,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3pos___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], 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;
@@ -34111,7 +31710,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3pos___get__(struct __pyx_o
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34120,18 +31719,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_3pos___get__(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_14reference_base_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7SNPCall_14reference_base___get__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3244
+/* "csamtools.pyx":3244
  *     property reference_base:
  *        '''reference base at pos. ``N`` if no reference sequence supplied.'''
  *        def __get__(self): return from_string_and_size( &self._reference_base, 1 )             # <<<<<<<<<<<<<<
@@ -34139,7 +31727,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_14reference_base_1__get__(P
  *     property genotype:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_14reference_base___get__(struct __pyx_obj_5pysam_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;
@@ -34147,10 +31736,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_14reference_base___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], 3244);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_5pysam_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;
@@ -34160,7 +31749,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_14reference_base___get__(st
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.reference_base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.reference_base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34169,18 +31758,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_14reference_base___get__(st
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_8genotype_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_8genotype_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7SNPCall_8genotype___get__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3248
+/* "csamtools.pyx":3248
  *     property genotype:
  *        '''the genotype called.'''
  *        def __get__(self): return from_string_and_size( &self._genotype, 1 )             # <<<<<<<<<<<<<<
@@ -34188,7 +31766,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_8genotype_1__get__(PyObject
  *     property consensus_quality:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8genotype___get__(struct __pyx_obj_5pysam_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;
@@ -34196,10 +31775,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8genotype___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], 3248);
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_5pysam_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;
@@ -34209,7 +31788,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8genotype___get__(struct __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.genotype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.genotype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34218,18 +31797,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8genotype___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_17consensus_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7SNPCall_17consensus_quality___get__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3252
+/* "csamtools.pyx":3252
  *     property consensus_quality:
  *        '''the genotype quality (Phred-scaled).'''
  *        def __get__(self): return self._consensus_quality             # <<<<<<<<<<<<<<
@@ -34237,7 +31805,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_17consensus_quality_1__get_
  *     property snp_quality:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_17consensus_quality___get__(struct __pyx_obj_5pysam_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;
@@ -34245,10 +31814,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_17consensus_quality___get__
   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;
@@ -34258,7 +31827,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_17consensus_quality___get__
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.consensus_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.consensus_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34267,18 +31836,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_17consensus_quality___get__
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_11snp_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7SNPCall_11snp_quality___get__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3256
+/* "csamtools.pyx":3256
  *     property snp_quality:
  *        '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.'''
  *        def __get__(self): return self._snp_quality             # <<<<<<<<<<<<<<
@@ -34286,7 +31844,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_11snp_quality_1__get__(PyOb
  *     property mapping_quality:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_11snp_quality___get__(struct __pyx_obj_5pysam_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;
@@ -34294,10 +31853,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_11snp_quality___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], 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;
@@ -34307,7 +31866,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_11snp_quality___get__(struc
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.snp_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.snp_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34316,18 +31875,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_11snp_quality___get__(struc
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_15mapping_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_7SNPCall_15mapping_quality___get__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3260
+/* "csamtools.pyx":3260
  *     property mapping_quality:
  *        '''the root mean square (rms) of the mapping quality of all reads involved in the call.'''
  *        def __get__(self): return self._rms_mapping_quality             # <<<<<<<<<<<<<<
@@ -34335,7 +31883,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_15mapping_quality_1__get__(
  *     property coverage:
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_15mapping_quality___get__(struct __pyx_obj_5pysam_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;
@@ -34343,10 +31892,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_15mapping_quality___get__(s
   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;
@@ -34356,7 +31905,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_15mapping_quality___get__(s
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.mapping_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.mapping_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34365,18 +31914,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_15mapping_quality___get__(s
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_8coverage_1__get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_8coverage_1__get__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7SNPCall_8coverage___get__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3264
+/* "csamtools.pyx":3264
  *     property coverage:
  *        '''coverage or read depth - the number of reads involved in the call.'''
  *        def __get__(self): return self._coverage             # <<<<<<<<<<<<<<
@@ -34384,7 +31922,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_8coverage_1__get__(PyObject
  *     def __str__(self):
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8coverage___get__(struct __pyx_obj_5pysam_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;
@@ -34392,10 +31931,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8coverage___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], 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;
@@ -34405,7 +31944,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8coverage___get__(struct __
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.coverage.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.coverage.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34414,18 +31953,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall_8coverage___get__(struct __
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_1__str__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_1__str__(PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5pysam_9csamtools_7SNPCall___str__(((struct __pyx_obj_5pysam_9csamtools_SNPCall *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3266
+/* "csamtools.pyx":3266
  *        def __get__(self): return self._coverage
  * 
  *     def __str__(self):             # <<<<<<<<<<<<<<
@@ -34433,7 +31961,8 @@ static PyObject *__pyx_pw_5pysam_9csamtools_7SNPCall_1__str__(PyObject *__pyx_v_
  *         return "\t".join( map(str, (
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall___str__(struct __pyx_obj_5pysam_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;
@@ -34450,10 +31979,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall___str__(struct __pyx_obj_5p
   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);
 
-  /* "pysam/csamtools.pyx":3268
+  /* "csamtools.pyx":3268
  *     def __str__(self):
  * 
  *         return "\t".join( map(str, (             # <<<<<<<<<<<<<<
@@ -34464,87 +31993,87 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall___str__(struct __pyx_obj_5p
   __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 = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "pysam/csamtools.pyx":3269
+  /* "csamtools.pyx":3269
  * 
  *         return "\t".join( map(str, (
  *                     self.tid,             # <<<<<<<<<<<<<<
  *                     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);
 
-  /* "pysam/csamtools.pyx":3270
+  /* "csamtools.pyx":3270
  *         return "\t".join( map(str, (
  *                     self.tid,
  *                     self.pos,             # <<<<<<<<<<<<<<
  *                     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);
 
-  /* "pysam/csamtools.pyx":3271
+  /* "csamtools.pyx":3271
  *                     self.tid,
  *                     self.pos,
  *                     self.reference_base,             # <<<<<<<<<<<<<<
  *                     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);
 
-  /* "pysam/csamtools.pyx":3272
+  /* "csamtools.pyx":3272
  *                     self.pos,
  *                     self.reference_base,
  *                     self.genotype,             # <<<<<<<<<<<<<<
  *                     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);
 
-  /* "pysam/csamtools.pyx":3273
+  /* "csamtools.pyx":3273
  *                     self.reference_base,
  *                     self.genotype,
  *                     self.consensus_quality,             # <<<<<<<<<<<<<<
  *                     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);
 
-  /* "pysam/csamtools.pyx":3274
+  /* "csamtools.pyx":3274
  *                     self.genotype,
  *                     self.consensus_quality,
  *                     self.snp_quality,             # <<<<<<<<<<<<<<
  *                     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);
 
-  /* "pysam/csamtools.pyx":3275
+  /* "csamtools.pyx":3275
  *                     self.consensus_quality,
  *                     self.snp_quality,
  *                     self.mapping_quality,             # <<<<<<<<<<<<<<
  *                     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);
 
-  /* "pysam/csamtools.pyx":3276
+  /* "csamtools.pyx":3276
  *                     self.snp_quality,
  *                     self.mapping_quality,
  *                     self.coverage ) ) )             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  __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);
@@ -34570,7 +32099,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall___str__(struct __pyx_obj_5p
   __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))));
@@ -34581,7 +32110,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall___str__(struct __pyx_obj_5p
   __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;
@@ -34606,7 +32135,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall___str__(struct __pyx_obj_5p
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_AddTraceback("pysam.csamtools.SNPCall.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.SNPCall.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -34615,30 +32144,47 @@ static PyObject *__pyx_pf_5pysam_9csamtools_7SNPCall___str__(struct __pyx_obj_5p
   return __pyx_r;
 }
 
-/* Python wrapper */
-static int __pyx_pw_5pysam_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pw_5pysam_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_5pysam_9csamtools_Samfile *__pyx_v_samfile = 0;
+/* "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;
+  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);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
     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:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -34647,7 +32193,7 @@ static int __pyx_pw_5pysam_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v
         }
       }
       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 (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)) {
@@ -34657,18 +32203,10 @@ static int __pyx_pw_5pysam_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v
         default: goto __pyx_L5_argtuple_error;
       }
     }
-    __pyx_v_samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)values[0]);
+    __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
     if (values[1]) {
       __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
-
-      /* "pysam/csamtools.pyx":3786
- *     """
- * 
- *     def __init__(self, Samfile samfile, int reopen = True ):             # <<<<<<<<<<<<<<
- *         self.samfile = samfile
- * 
- */
       __pyx_v_reopen = ((int)1);
     }
   }
@@ -34676,37 +32214,13 @@ static int __pyx_pw_5pysam_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("pysam.csamtools.IndexedReads.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IndexedReads.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_5pysam_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(((struct __pyx_obj_5pysam_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_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5pysam_9csamtools_IndexedReads *__pyx_v_self, struct __pyx_obj_5pysam_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;
-  samfile_t *__pyx_t_4;
-  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);
+  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;}
 
-  /* "pysam/csamtools.pyx":3787
+  /* "csamtools.pyx":3787
  * 
  *     def __init__(self, Samfile samfile, int reopen = True ):
  *         self.samfile = samfile             # <<<<<<<<<<<<<<
@@ -34715,11 +32229,11 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
  */
   __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;
 
-  /* "pysam/csamtools.pyx":3789
+  /* "csamtools.pyx":3789
  *         self.samfile = samfile
  * 
  *         if samfile.isbam: mode = b"rb"             # <<<<<<<<<<<<<<
@@ -34729,11 +32243,11 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
   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*/ {
 
-    /* "pysam/csamtools.pyx":3790
+    /* "csamtools.pyx":3790
  * 
  *         if samfile.isbam: mode = b"rb"
  *         else: mode = b"r"             # <<<<<<<<<<<<<<
@@ -34743,9 +32257,9 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
     __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
     __pyx_v_mode = __pyx_n_b__r;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "pysam/csamtools.pyx":3794
+  /* "csamtools.pyx":3794
  *         # reopen the file - note that this makes the iterator
  *         # slow and causes pileup to slow down significantly.
  *         if reopen:             # <<<<<<<<<<<<<<
@@ -34754,7 +32268,7 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
  */
   if (__pyx_v_reopen) {
 
-    /* "pysam/csamtools.pyx":3795
+    /* "csamtools.pyx":3795
  *         # slow and causes pileup to slow down significantly.
  *         if reopen:
  *             store = StderrStore()             # <<<<<<<<<<<<<<
@@ -34769,7 +32283,7 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
     __pyx_v_store = __pyx_t_2;
     __pyx_t_2 = 0;
 
-    /* "pysam/csamtools.pyx":3796
+    /* "csamtools.pyx":3796
  *         if reopen:
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )             # <<<<<<<<<<<<<<
@@ -34777,9 +32291,9 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
  *             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);
 
-    /* "pysam/csamtools.pyx":3797
+    /* "csamtools.pyx":3797
  *             store = StderrStore()
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()             # <<<<<<<<<<<<<<
@@ -34793,7 +32307,7 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "pysam/csamtools.pyx":3798
+    /* "csamtools.pyx":3798
  *             self.fp = samopen( samfile._filename, mode, NULL )
  *             store.release()
  *             assert self.fp != NULL             # <<<<<<<<<<<<<<
@@ -34801,46 +32315,45 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
  *         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;}
     }
     #endif
 
-    /* "pysam/csamtools.pyx":3799
+    /* "csamtools.pyx":3799
  *             store.release()
  *             assert self.fp != NULL
  *             self.owns_samfile = True             # <<<<<<<<<<<<<<
  *         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*/ {
 
-    /* "pysam/csamtools.pyx":3801
+    /* "csamtools.pyx":3801
  *             self.owns_samfile = True
  *         else:
  *             self.fp = samfile.samfile             # <<<<<<<<<<<<<<
  *             self.owns_samfile = False
  * 
  */
-    __pyx_t_4 = __pyx_v_samfile->samfile;
-    __pyx_v_self->fp = __pyx_t_4;
+    ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
 
-    /* "pysam/csamtools.pyx":3802
+    /* "csamtools.pyx":3802
  *         else:
  *             self.fp = samfile.samfile
  *             self.owns_samfile = False             # <<<<<<<<<<<<<<
  * 
  *         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:;
 
-  /* "pysam/csamtools.pyx":3804
+  /* "csamtools.pyx":3804
  *             self.owns_samfile = False
  * 
  *         assert samfile.isbam, "can only IndexReads on bam files"             # <<<<<<<<<<<<<<
@@ -34859,7 +32372,7 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_AddTraceback("pysam.csamtools.IndexedReads.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IndexedReads.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_mode);
@@ -34869,19 +32382,7 @@ static int __pyx_pf_5pysam_9csamtools_12IndexedReads___init__(struct __pyx_obj_5
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_12IndexedReads_3build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_12IndexedReads_2build[] = "IndexedReads.build(self)\nbuild index.";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_12IndexedReads_2build(((struct __pyx_obj_5pysam_9csamtools_IndexedReads *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3806
+/* "csamtools.pyx":3806
  *         assert samfile.isbam, "can only IndexReads on bam files"
  * 
  *     def build( self ):             # <<<<<<<<<<<<<<
@@ -34889,7 +32390,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_12IndexedReads_3build(PyObject *__py
  * 
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_obj_5pysam_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;
@@ -34904,10 +32407,10 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
   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);
 
-  /* "pysam/csamtools.pyx":3809
+  /* "csamtools.pyx":3809
  *         '''build index.'''
  * 
  *         self.index = collections.defaultdict( list )             # <<<<<<<<<<<<<<
@@ -34920,7 +32423,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
   __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))));
@@ -34929,12 +32432,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
   __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;
 
-  /* "pysam/csamtools.pyx":3813
+  /* "csamtools.pyx":3813
  *         # this method will start indexing from the current file position
  *         # if you decide
  *         cdef int ret = 1             # <<<<<<<<<<<<<<
@@ -34943,7 +32446,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
  */
   __pyx_v_ret = 1;
 
-  /* "pysam/csamtools.pyx":3814
+  /* "csamtools.pyx":3814
  *         # if you decide
  *         cdef int ret = 1
  *         cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) )             # <<<<<<<<<<<<<<
@@ -34952,7 +32455,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
  */
   __pyx_v_b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
 
-  /* "pysam/csamtools.pyx":3818
+  /* "csamtools.pyx":3818
  *         cdef uint64_t pos
  * 
  *         while ret > 0:             # <<<<<<<<<<<<<<
@@ -34963,25 +32466,25 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
     __pyx_t_4 = (__pyx_v_ret > 0);
     if (!__pyx_t_4) break;
 
-    /* "pysam/csamtools.pyx":3819
+    /* "csamtools.pyx":3819
  * 
  *         while ret > 0:
  *             pos = bam_tell( self.fp.x.bam )             # <<<<<<<<<<<<<<
  *             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);
 
-    /* "pysam/csamtools.pyx":3820
+    /* "csamtools.pyx":3820
  *         while ret > 0:
  *             pos = bam_tell( self.fp.x.bam )
  *             ret = samread( self.fp, b)             # <<<<<<<<<<<<<<
  *             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);
 
-    /* "pysam/csamtools.pyx":3821
+    /* "csamtools.pyx":3821
  *             pos = bam_tell( self.fp.x.bam )
  *             ret = samread( self.fp, b)
  *             if ret > 0:             # <<<<<<<<<<<<<<
@@ -34991,27 +32494,27 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
     __pyx_t_4 = (__pyx_v_ret > 0);
     if (__pyx_t_4) {
 
-      /* "pysam/csamtools.pyx":3822
+      /* "csamtools.pyx":3822
  *             ret = samread( self.fp, b)
  *             if ret > 0:
  *                 qname = _charptr_to_str(bam1_qname( b ))             # <<<<<<<<<<<<<<
  *                 self.index[qname].append( pos )
  * 
  */
-      __pyx_t_3 = __pyx_f_5pysam_9csamtools__charptr_to_str(bam1_qname(__pyx_v_b)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_f_9csamtools__charptr_to_str(bam1_qname(__pyx_v_b)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_XDECREF(__pyx_v_qname);
       __pyx_v_qname = __pyx_t_3;
       __pyx_t_3 = 0;
 
-      /* "pysam/csamtools.pyx":3823
+      /* "csamtools.pyx":3823
  *             if ret > 0:
  *                 qname = _charptr_to_str(bam1_qname( b ))
  *                 self.index[qname].append( pos )             # <<<<<<<<<<<<<<
  * 
  *         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);
@@ -35020,12 +32523,12 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
       __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:;
   }
 
-  /* "pysam/csamtools.pyx":3825
+  /* "csamtools.pyx":3825
  *                 self.index[qname].append( pos )
  * 
  *         bam_destroy1( b )             # <<<<<<<<<<<<<<
@@ -35040,7 +32543,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("pysam.csamtools.IndexedReads.build", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IndexedReads.build", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_v_qname);
@@ -35050,19 +32553,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_2build(struct __pyx_o
   return __pyx_r;
 }
 
-/* Python wrapper */
-static PyObject *__pyx_pw_5pysam_9csamtools_12IndexedReads_5find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
-static char __pyx_doc_5pysam_9csamtools_12IndexedReads_4find[] = "IndexedReads.find(self, qname)";
-static PyObject *__pyx_pw_5pysam_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_5pysam_9csamtools_12IndexedReads_4find(((struct __pyx_obj_5pysam_9csamtools_IndexedReads *)__pyx_v_self), ((PyObject *)__pyx_v_qname));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "pysam/csamtools.pyx":3827
+/* "csamtools.pyx":3827
  *         bam_destroy1( b )
  * 
  *     def find( self, qname ):             # <<<<<<<<<<<<<<
@@ -35070,7 +32561,9 @@ static PyObject *__pyx_pw_5pysam_9csamtools_12IndexedReads_5find(PyObject *__pyx
  *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
  */
 
-static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_obj_5pysam_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;
@@ -35081,20 +32574,20 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_ob
   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);
 
-  /* "pysam/csamtools.pyx":3828
+  /* "csamtools.pyx":3828
  * 
  *     def find( self, qname ):
  *         if qname in self.index:             # <<<<<<<<<<<<<<
  *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
  *         else:
  */
-  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_qname, __pyx_v_self->index, Py_EQ)); 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) {
 
-    /* "pysam/csamtools.pyx":3829
+    /* "csamtools.pyx":3829
  *     def find( self, qname ):
  *         if qname in self.index:
  *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )             # <<<<<<<<<<<<<<
@@ -35102,13 +32595,13 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_ob
  *             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;
@@ -35118,18 +32611,18 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_ob
     __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_5pysam_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*/ {
 
-    /* "pysam/csamtools.pyx":3831
+    /* "csamtools.pyx":3831
  *             return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
  *         else:
  *             raise KeyError( "read %s not found" % qname )             # <<<<<<<<<<<<<<
@@ -35139,7 +32632,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_ob
     __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;
@@ -35150,7 +32643,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_ob
     __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;
@@ -35158,7 +32651,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_ob
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("pysam.csamtools.IndexedReads.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("csamtools.IndexedReads.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
@@ -35167,16 +32660,7 @@ static PyObject *__pyx_pf_5pysam_9csamtools_12IndexedReads_4find(struct __pyx_ob
   return __pyx_r;
 }
 
-/* Python wrapper */
-static void __pyx_pw_5pysam_9csamtools_12IndexedReads_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_5pysam_9csamtools_12IndexedReads_7__dealloc__(PyObject *__pyx_v_self) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
-  __pyx_pf_5pysam_9csamtools_12IndexedReads_6__dealloc__(((struct __pyx_obj_5pysam_9csamtools_IndexedReads *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "pysam/csamtools.pyx":3833
+/* "csamtools.pyx":3833
  *             raise KeyError( "read %s not found" % qname )
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
@@ -35184,48 +32668,49 @@ static void __pyx_pw_5pysam_9csamtools_12IndexedReads_7__dealloc__(PyObject *__p
  * 
  */
 
-static void __pyx_pf_5pysam_9csamtools_12IndexedReads_6__dealloc__(struct __pyx_obj_5pysam_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);
 
-  /* "pysam/csamtools.pyx":3834
+  /* "csamtools.pyx":3834
  * 
  *     def __dealloc__(self):
  *         if self.owns_samfile: samclose( self.fp )             # <<<<<<<<<<<<<<
  * 
  * __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();
 }
-static struct __pyx_vtabstruct_5pysam_9csamtools_Fastafile __pyx_vtable_5pysam_9csamtools_Fastafile;
+static struct __pyx_vtabstruct_9csamtools_Fastafile __pyx_vtable_9csamtools_Fastafile;
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_Fastafile(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_Fastafile *p;
+static PyObject *__pyx_tp_new_9csamtools_Fastafile(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_Fastafile *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_Fastafile *)o);
-  p->__pyx_vtab = __pyx_vtabptr_5pysam_9csamtools_Fastafile;
-  if (__pyx_pw_5pysam_9csamtools_9Fastafile_1__cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_Fastafile *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_Fastafile;
+  if (__pyx_pf_9csamtools_9Fastafile___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_Fastafile(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_Fastafile(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_5pysam_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);
@@ -35233,20 +32718,20 @@ static void __pyx_tp_dealloc_5pysam_9csamtools_Fastafile(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_9Fastafile_filename(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_9Fastafile_8filename_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_9Fastafile_filename(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_9Fastafile_8filename___get__(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_Fastafile[] = {
-  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_5pysam_9csamtools_9Fastafile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_9Fastafile_2_isOpen)},
-  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_5pysam_9csamtools_9Fastafile_7_open, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_9Fastafile_6_open)},
-  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_5pysam_9csamtools_9Fastafile_9close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_9Fastafile_8close)},
-  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_5pysam_9csamtools_9Fastafile_13fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_9Fastafile_12fetch)},
+static PyMethodDef __pyx_methods_9csamtools_Fastafile[] = {
+  {__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}
 };
 
-static struct PyGetSetDef __pyx_getsets_5pysam_9csamtools_Fastafile[] = {
-  {(char *)"filename", __pyx_getprop_5pysam_9csamtools_9Fastafile_filename, 0, __Pyx_DOCSTR(__pyx_k_187), 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_Fastafile[] = {
+  {(char *)"filename", __pyx_getprop_9csamtools_9Fastafile_filename, 0, __Pyx_DOCSTR(__pyx_k_187), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -35309,7 +32794,7 @@ static PyNumberMethods __pyx_tp_as_number_Fastafile = {
 };
 
 static PySequenceMethods __pyx_tp_as_sequence_Fastafile = {
-  __pyx_pw_5pysam_9csamtools_9Fastafile_5__len__, /*sq_length*/
+  __pyx_pf_9csamtools_9Fastafile_2__len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
   0, /*sq_item*/
@@ -35322,7 +32807,7 @@ static PySequenceMethods __pyx_tp_as_sequence_Fastafile = {
 };
 
 static PyMappingMethods __pyx_tp_as_mapping_Fastafile = {
-  __pyx_pw_5pysam_9csamtools_9Fastafile_5__len__, /*mp_length*/
+  __pyx_pf_9csamtools_9Fastafile_2__len__, /*mp_length*/
   0, /*mp_subscript*/
   0, /*mp_ass_subscript*/
 };
@@ -35348,12 +32833,12 @@ static PyBufferProcs __pyx_tp_as_buffer_Fastafile = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_Fastafile = {
+static PyTypeObject __pyx_type_9csamtools_Fastafile = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.Fastafile"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_Fastafile), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.Fastafile"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_Fastafile), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_Fastafile, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_Fastafile, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -35380,9 +32865,9 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_Fastafile = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_Fastafile, /*tp_methods*/
+  __pyx_methods_9csamtools_Fastafile, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_5pysam_9csamtools_Fastafile, /*tp_getset*/
+  __pyx_getsets_9csamtools_Fastafile, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -35390,7 +32875,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_Fastafile = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_Fastafile, /*tp_new*/
+  __pyx_tp_new_9csamtools_Fastafile, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -35404,18 +32889,18 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_Fastafile = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_AlignedRead(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_9csamtools_AlignedRead(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_AlignedRead(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_AlignedRead(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_5pysam_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);
@@ -35423,13 +32908,13 @@ static void __pyx_tp_dealloc_5pysam_9csamtools_AlignedRead(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_qname(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_5qname_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qname(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5qname___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_5qname_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35437,13 +32922,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_qname(PyObject *o, PyOb
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_cigar(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_5cigar_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigar(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5cigar___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_5cigar_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35451,13 +32936,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_cigar(PyObject *o, PyOb
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_cigarstring(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_11cigarstring_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigarstring(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_cigarstring(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_cigarstring(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_11cigarstring_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_11cigarstring_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35465,13 +32950,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_cigarstring(PyObject *o
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_seq(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_3seq_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_seq(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_3seq___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_3seq_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35479,13 +32964,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_seq(PyObject *o, PyObje
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_qual(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4qual_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qual(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4qual___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_4qual_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35493,33 +32978,33 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_qual(PyObject *o, PyObj
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_query(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_5query_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_query(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5query___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_qqual(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_5qqual_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qqual(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5qqual___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_qstart(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_6qstart_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qstart(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_6qstart___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_qend(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4qend_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qend(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4qend___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_qlen(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4qlen_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qlen(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4qlen___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_tags(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4tags_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tags(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4tags___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_4tags_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35527,13 +33012,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_tags(PyObject *o, PyObj
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_flag(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4flag_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_flag(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4flag___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_4flag_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35541,13 +33026,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_flag(PyObject *o, PyObj
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_rname(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_5rname_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rname(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5rname___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_5rname_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35555,13 +33040,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_rname(PyObject *o, PyOb
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_tid(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_3tid_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tid(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_3tid___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_3tid_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35569,13 +33054,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_tid(PyObject *o, PyObje
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_pos(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_3pos_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_3pos___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_3pos_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35583,13 +33068,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_pos(PyObject *o, PyObje
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_bin(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_3bin_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_bin(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_3bin___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_3bin_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35597,25 +33082,25 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_bin(PyObject *o, PyObje
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_rlen(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4rlen_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rlen(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4rlen___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_aend(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4aend_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aend(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4aend___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_alen(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4alen_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_alen(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4alen___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_mapq(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4mapq_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mapq(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4mapq___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_4mapq_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35623,13 +33108,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mapq(PyObject *o, PyObj
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_mrnm(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4mrnm_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mrnm(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_4mrnm_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35637,13 +33122,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObj
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_rnext(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_5rnext_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rnext(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5rnext___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_rnext(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_rnext(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_5rnext_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35651,13 +33136,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_rnext(PyObject *o, PyOb
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_mpos(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4mpos_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mpos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4mpos___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_4mpos_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35665,13 +33150,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mpos(PyObject *o, PyObj
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_pnext(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_5pnext_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pnext(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5pnext___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_pnext(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_pnext(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_5pnext_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35679,13 +33164,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_pnext(PyObject *o, PyOb
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_isize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_5isize_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_isize(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_5isize___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_5isize_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35693,13 +33178,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_isize(PyObject *o, PyOb
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_tlen(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_4tlen_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tlen(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_4tlen___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_tlen(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_tlen(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11AlignedRead_4tlen_3__set__(o, v);
+    return __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -35707,13 +33192,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_tlen(PyObject *o, PyObj
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_paired(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_9is_paired_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_paired(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35721,13 +33206,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_paired(PyObject *o,
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_14is_proper_pair_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35735,13 +33220,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_proper_pair(PyObject
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_unmapped(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_11is_unmapped_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35749,13 +33234,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_unmapped(PyObject *o
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35763,13 +33248,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mate_is_unmapped(PyObje
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_reverse(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_10is_reverse_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35777,13 +33262,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_reverse(PyObject *o,
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35791,13 +33276,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_mate_is_reverse(PyObjec
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_read1(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read1_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read1(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35805,13 +33290,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_read1(PyObject *o, P
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_read2(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_8is_read2_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read2(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35819,13 +33304,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_read2(PyObject *o, P
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_secondary(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_12is_secondary_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35833,13 +33318,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_secondary(PyObject *
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_qcfail(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_9is_qcfail_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35847,13 +33332,13 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_qcfail(PyObject *o,
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_is_duplicate(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_12is_duplicate_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_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__");
@@ -35861,62 +33346,62 @@ static int __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_duplicate(PyObject *
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_positions(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_9positions_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_positions(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_9positions___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11AlignedRead_aligned_pairs(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11AlignedRead_13aligned_pairs_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aligned_pairs(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_AlignedRead[] = {
-  {__Pyx_NAMESTR("compare"), (PyCFunction)__pyx_pw_5pysam_9csamtools_11AlignedRead_7compare, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_11AlignedRead_6compare)},
-  {__Pyx_NAMESTR("overlap"), (PyCFunction)__pyx_pw_5pysam_9csamtools_11AlignedRead_11overlap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_11AlignedRead_10overlap)},
-  {__Pyx_NAMESTR("opt"), (PyCFunction)__pyx_pw_5pysam_9csamtools_11AlignedRead_13opt, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_11AlignedRead_12opt)},
-  {__Pyx_NAMESTR("fancy_str"), (PyCFunction)__pyx_pw_5pysam_9csamtools_11AlignedRead_15fancy_str, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_11AlignedRead_14fancy_str)},
+static PyMethodDef __pyx_methods_9csamtools_AlignedRead[] = {
+  {__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}
 };
 
-static struct PyGetSetDef __pyx_getsets_5pysam_9csamtools_AlignedRead[] = {
-  {(char *)"qname", __pyx_getprop_5pysam_9csamtools_11AlignedRead_qname, __pyx_setprop_5pysam_9csamtools_11AlignedRead_qname, __Pyx_DOCSTR(__pyx_k_188), 0},
-  {(char *)"cigar", __pyx_getprop_5pysam_9csamtools_11AlignedRead_cigar, __pyx_setprop_5pysam_9csamtools_11AlignedRead_cigar, __Pyx_DOCSTR(__pyx_k_189), 0},
-  {(char *)"cigarstring", __pyx_getprop_5pysam_9csamtools_11AlignedRead_cigarstring, __pyx_setprop_5pysam_9csamtools_11AlignedRead_cigarstring, __Pyx_DOCSTR(__pyx_k_190), 0},
-  {(char *)"seq", __pyx_getprop_5pysam_9csamtools_11AlignedRead_seq, __pyx_setprop_5pysam_9csamtools_11AlignedRead_seq, __Pyx_DOCSTR(__pyx_k_191), 0},
-  {(char *)"qual", __pyx_getprop_5pysam_9csamtools_11AlignedRead_qual, __pyx_setprop_5pysam_9csamtools_11AlignedRead_qual, __Pyx_DOCSTR(__pyx_k_192), 0},
-  {(char *)"query", __pyx_getprop_5pysam_9csamtools_11AlignedRead_query, 0, __Pyx_DOCSTR(__pyx_k_193), 0},
-  {(char *)"qqual", __pyx_getprop_5pysam_9csamtools_11AlignedRead_qqual, 0, __Pyx_DOCSTR(__pyx_k_194), 0},
-  {(char *)"qstart", __pyx_getprop_5pysam_9csamtools_11AlignedRead_qstart, 0, __Pyx_DOCSTR(__pyx_k_195), 0},
-  {(char *)"qend", __pyx_getprop_5pysam_9csamtools_11AlignedRead_qend, 0, __Pyx_DOCSTR(__pyx_k_196), 0},
-  {(char *)"qlen", __pyx_getprop_5pysam_9csamtools_11AlignedRead_qlen, 0, __Pyx_DOCSTR(__pyx_k_197), 0},
-  {(char *)"tags", __pyx_getprop_5pysam_9csamtools_11AlignedRead_tags, __pyx_setprop_5pysam_9csamtools_11AlignedRead_tags, __Pyx_DOCSTR(__pyx_k_198), 0},
-  {(char *)"flag", __pyx_getprop_5pysam_9csamtools_11AlignedRead_flag, __pyx_setprop_5pysam_9csamtools_11AlignedRead_flag, __Pyx_DOCSTR(__pyx_k_199), 0},
-  {(char *)"rname", __pyx_getprop_5pysam_9csamtools_11AlignedRead_rname, __pyx_setprop_5pysam_9csamtools_11AlignedRead_rname, __Pyx_DOCSTR(__pyx_k_200), 0},
-  {(char *)"tid", __pyx_getprop_5pysam_9csamtools_11AlignedRead_tid, __pyx_setprop_5pysam_9csamtools_11AlignedRead_tid, __Pyx_DOCSTR(__pyx_k_201), 0},
-  {(char *)"pos", __pyx_getprop_5pysam_9csamtools_11AlignedRead_pos, __pyx_setprop_5pysam_9csamtools_11AlignedRead_pos, __Pyx_DOCSTR(__pyx_k_202), 0},
-  {(char *)"bin", __pyx_getprop_5pysam_9csamtools_11AlignedRead_bin, __pyx_setprop_5pysam_9csamtools_11AlignedRead_bin, __Pyx_DOCSTR(__pyx_k_203), 0},
-  {(char *)"rlen", __pyx_getprop_5pysam_9csamtools_11AlignedRead_rlen, 0, __Pyx_DOCSTR(__pyx_k_204), 0},
-  {(char *)"aend", __pyx_getprop_5pysam_9csamtools_11AlignedRead_aend, 0, __Pyx_DOCSTR(__pyx_k_205), 0},
-  {(char *)"alen", __pyx_getprop_5pysam_9csamtools_11AlignedRead_alen, 0, __Pyx_DOCSTR(__pyx_k_206), 0},
-  {(char *)"mapq", __pyx_getprop_5pysam_9csamtools_11AlignedRead_mapq, __pyx_setprop_5pysam_9csamtools_11AlignedRead_mapq, __Pyx_DOCSTR(__pyx_k_207), 0},
-  {(char *)"mrnm", __pyx_getprop_5pysam_9csamtools_11AlignedRead_mrnm, __pyx_setprop_5pysam_9csamtools_11AlignedRead_mrnm, __Pyx_DOCSTR(__pyx_k_208), 0},
-  {(char *)"rnext", __pyx_getprop_5pysam_9csamtools_11AlignedRead_rnext, __pyx_setprop_5pysam_9csamtools_11AlignedRead_rnext, __Pyx_DOCSTR(__pyx_k_209), 0},
-  {(char *)"mpos", __pyx_getprop_5pysam_9csamtools_11AlignedRead_mpos, __pyx_setprop_5pysam_9csamtools_11AlignedRead_mpos, __Pyx_DOCSTR(__pyx_k_210), 0},
-  {(char *)"pnext", __pyx_getprop_5pysam_9csamtools_11AlignedRead_pnext, __pyx_setprop_5pysam_9csamtools_11AlignedRead_pnext, __Pyx_DOCSTR(__pyx_k_211), 0},
-  {(char *)"isize", __pyx_getprop_5pysam_9csamtools_11AlignedRead_isize, __pyx_setprop_5pysam_9csamtools_11AlignedRead_isize, __Pyx_DOCSTR(__pyx_k_212), 0},
-  {(char *)"tlen", __pyx_getprop_5pysam_9csamtools_11AlignedRead_tlen, __pyx_setprop_5pysam_9csamtools_11AlignedRead_tlen, __Pyx_DOCSTR(__pyx_k_213), 0},
-  {(char *)"is_paired", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_paired, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_paired, __Pyx_DOCSTR(__pyx_k_214), 0},
-  {(char *)"is_proper_pair", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_proper_pair, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_proper_pair, __Pyx_DOCSTR(__pyx_k_215), 0},
-  {(char *)"is_unmapped", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_unmapped, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_unmapped, __Pyx_DOCSTR(__pyx_k_216), 0},
-  {(char *)"mate_is_unmapped", __pyx_getprop_5pysam_9csamtools_11AlignedRead_mate_is_unmapped, __pyx_setprop_5pysam_9csamtools_11AlignedRead_mate_is_unmapped, __Pyx_DOCSTR(__pyx_k_217), 0},
-  {(char *)"is_reverse", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_reverse, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_reverse, __Pyx_DOCSTR(__pyx_k_218), 0},
-  {(char *)"mate_is_reverse", __pyx_getprop_5pysam_9csamtools_11AlignedRead_mate_is_reverse, __pyx_setprop_5pysam_9csamtools_11AlignedRead_mate_is_reverse, __Pyx_DOCSTR(__pyx_k_219), 0},
-  {(char *)"is_read1", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_read1, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_read1, __Pyx_DOCSTR(__pyx_k_220), 0},
-  {(char *)"is_read2", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_read2, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_read2, __Pyx_DOCSTR(__pyx_k_221), 0},
-  {(char *)"is_secondary", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_secondary, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_secondary, __Pyx_DOCSTR(__pyx_k_222), 0},
-  {(char *)"is_qcfail", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_qcfail, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_qcfail, __Pyx_DOCSTR(__pyx_k_223), 0},
-  {(char *)"is_duplicate", __pyx_getprop_5pysam_9csamtools_11AlignedRead_is_duplicate, __pyx_setprop_5pysam_9csamtools_11AlignedRead_is_duplicate, __Pyx_DOCSTR(__pyx_k_224), 0},
-  {(char *)"positions", __pyx_getprop_5pysam_9csamtools_11AlignedRead_positions, 0, __Pyx_DOCSTR(__pyx_k_225), 0},
-  {(char *)"aligned_pairs", __pyx_getprop_5pysam_9csamtools_11AlignedRead_aligned_pairs, 0, __Pyx_DOCSTR(__pyx_k_226), 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_AlignedRead[] = {
+  {(char *)"qname", __pyx_getprop_9csamtools_11AlignedRead_qname, __pyx_setprop_9csamtools_11AlignedRead_qname, __Pyx_DOCSTR(__pyx_k_188), 0},
+  {(char *)"cigar", __pyx_getprop_9csamtools_11AlignedRead_cigar, __pyx_setprop_9csamtools_11AlignedRead_cigar, __Pyx_DOCSTR(__pyx_k_189), 0},
+  {(char *)"cigarstring", __pyx_getprop_9csamtools_11AlignedRead_cigarstring, __pyx_setprop_9csamtools_11AlignedRead_cigarstring, __Pyx_DOCSTR(__pyx_k_190), 0},
+  {(char *)"seq", __pyx_getprop_9csamtools_11AlignedRead_seq, __pyx_setprop_9csamtools_11AlignedRead_seq, __Pyx_DOCSTR(__pyx_k_191), 0},
+  {(char *)"qual", __pyx_getprop_9csamtools_11AlignedRead_qual, __pyx_setprop_9csamtools_11AlignedRead_qual, __Pyx_DOCSTR(__pyx_k_192), 0},
+  {(char *)"query", __pyx_getprop_9csamtools_11AlignedRead_query, 0, __Pyx_DOCSTR(__pyx_k_193), 0},
+  {(char *)"qqual", __pyx_getprop_9csamtools_11AlignedRead_qqual, 0, __Pyx_DOCSTR(__pyx_k_194), 0},
+  {(char *)"qstart", __pyx_getprop_9csamtools_11AlignedRead_qstart, 0, __Pyx_DOCSTR(__pyx_k_195), 0},
+  {(char *)"qend", __pyx_getprop_9csamtools_11AlignedRead_qend, 0, __Pyx_DOCSTR(__pyx_k_196), 0},
+  {(char *)"qlen", __pyx_getprop_9csamtools_11AlignedRead_qlen, 0, __Pyx_DOCSTR(__pyx_k_197), 0},
+  {(char *)"tags", __pyx_getprop_9csamtools_11AlignedRead_tags, __pyx_setprop_9csamtools_11AlignedRead_tags, __Pyx_DOCSTR(__pyx_k_198), 0},
+  {(char *)"flag", __pyx_getprop_9csamtools_11AlignedRead_flag, __pyx_setprop_9csamtools_11AlignedRead_flag, __Pyx_DOCSTR(__pyx_k_199), 0},
+  {(char *)"rname", __pyx_getprop_9csamtools_11AlignedRead_rname, __pyx_setprop_9csamtools_11AlignedRead_rname, __Pyx_DOCSTR(__pyx_k_200), 0},
+  {(char *)"tid", __pyx_getprop_9csamtools_11AlignedRead_tid, __pyx_setprop_9csamtools_11AlignedRead_tid, __Pyx_DOCSTR(__pyx_k_201), 0},
+  {(char *)"pos", __pyx_getprop_9csamtools_11AlignedRead_pos, __pyx_setprop_9csamtools_11AlignedRead_pos, __Pyx_DOCSTR(__pyx_k_202), 0},
+  {(char *)"bin", __pyx_getprop_9csamtools_11AlignedRead_bin, __pyx_setprop_9csamtools_11AlignedRead_bin, __Pyx_DOCSTR(__pyx_k_203), 0},
+  {(char *)"rlen", __pyx_getprop_9csamtools_11AlignedRead_rlen, 0, __Pyx_DOCSTR(__pyx_k_204), 0},
+  {(char *)"aend", __pyx_getprop_9csamtools_11AlignedRead_aend, 0, __Pyx_DOCSTR(__pyx_k_205), 0},
+  {(char *)"alen", __pyx_getprop_9csamtools_11AlignedRead_alen, 0, __Pyx_DOCSTR(__pyx_k_206), 0},
+  {(char *)"mapq", __pyx_getprop_9csamtools_11AlignedRead_mapq, __pyx_setprop_9csamtools_11AlignedRead_mapq, __Pyx_DOCSTR(__pyx_k_207), 0},
+  {(char *)"mrnm", __pyx_getprop_9csamtools_11AlignedRead_mrnm, __pyx_setprop_9csamtools_11AlignedRead_mrnm, __Pyx_DOCSTR(__pyx_k_208), 0},
+  {(char *)"rnext", __pyx_getprop_9csamtools_11AlignedRead_rnext, __pyx_setprop_9csamtools_11AlignedRead_rnext, __Pyx_DOCSTR(__pyx_k_209), 0},
+  {(char *)"mpos", __pyx_getprop_9csamtools_11AlignedRead_mpos, __pyx_setprop_9csamtools_11AlignedRead_mpos, __Pyx_DOCSTR(__pyx_k_210), 0},
+  {(char *)"pnext", __pyx_getprop_9csamtools_11AlignedRead_pnext, __pyx_setprop_9csamtools_11AlignedRead_pnext, __Pyx_DOCSTR(__pyx_k_211), 0},
+  {(char *)"isize", __pyx_getprop_9csamtools_11AlignedRead_isize, __pyx_setprop_9csamtools_11AlignedRead_isize, __Pyx_DOCSTR(__pyx_k_212), 0},
+  {(char *)"tlen", __pyx_getprop_9csamtools_11AlignedRead_tlen, __pyx_setprop_9csamtools_11AlignedRead_tlen, __Pyx_DOCSTR(__pyx_k_213), 0},
+  {(char *)"is_paired", __pyx_getprop_9csamtools_11AlignedRead_is_paired, __pyx_setprop_9csamtools_11AlignedRead_is_paired, __Pyx_DOCSTR(__pyx_k_214), 0},
+  {(char *)"is_proper_pair", __pyx_getprop_9csamtools_11AlignedRead_is_proper_pair, __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair, __Pyx_DOCSTR(__pyx_k_215), 0},
+  {(char *)"is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_is_unmapped, __Pyx_DOCSTR(__pyx_k_216), 0},
+  {(char *)"mate_is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped, __Pyx_DOCSTR(__pyx_k_217), 0},
+  {(char *)"is_reverse", __pyx_getprop_9csamtools_11AlignedRead_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_is_reverse, __Pyx_DOCSTR(__pyx_k_218), 0},
+  {(char *)"mate_is_reverse", __pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse, __Pyx_DOCSTR(__pyx_k_219), 0},
+  {(char *)"is_read1", __pyx_getprop_9csamtools_11AlignedRead_is_read1, __pyx_setprop_9csamtools_11AlignedRead_is_read1, __Pyx_DOCSTR(__pyx_k_220), 0},
+  {(char *)"is_read2", __pyx_getprop_9csamtools_11AlignedRead_is_read2, __pyx_setprop_9csamtools_11AlignedRead_is_read2, __Pyx_DOCSTR(__pyx_k_221), 0},
+  {(char *)"is_secondary", __pyx_getprop_9csamtools_11AlignedRead_is_secondary, __pyx_setprop_9csamtools_11AlignedRead_is_secondary, __Pyx_DOCSTR(__pyx_k_222), 0},
+  {(char *)"is_qcfail", __pyx_getprop_9csamtools_11AlignedRead_is_qcfail, __pyx_setprop_9csamtools_11AlignedRead_is_qcfail, __Pyx_DOCSTR(__pyx_k_223), 0},
+  {(char *)"is_duplicate", __pyx_getprop_9csamtools_11AlignedRead_is_duplicate, __pyx_setprop_9csamtools_11AlignedRead_is_duplicate, __Pyx_DOCSTR(__pyx_k_224), 0},
+  {(char *)"positions", __pyx_getprop_9csamtools_11AlignedRead_positions, 0, __Pyx_DOCSTR(__pyx_k_225), 0},
+  {(char *)"aligned_pairs", __pyx_getprop_9csamtools_11AlignedRead_aligned_pairs, 0, __Pyx_DOCSTR(__pyx_k_226), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -36018,12 +33503,12 @@ static PyBufferProcs __pyx_tp_as_buffer_AlignedRead = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_AlignedRead = {
+static PyTypeObject __pyx_type_9csamtools_AlignedRead = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.AlignedRead"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_AlignedRead), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.AlignedRead"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_AlignedRead), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_AlignedRead, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_AlignedRead, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -36036,9 +33521,9 @@ static PyTypeObject __pyx_type_5pysam_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_5pysam_9csamtools_11AlignedRead_9__hash__, /*tp_hash*/
+  __pyx_pf_9csamtools_11AlignedRead_4__hash__, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pw_5pysam_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*/
@@ -36050,17 +33535,17 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_AlignedRead = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_AlignedRead, /*tp_methods*/
+  __pyx_methods_9csamtools_AlignedRead, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_5pysam_9csamtools_AlignedRead, /*tp_getset*/
+  __pyx_getsets_9csamtools_AlignedRead, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_5pysam_9csamtools_11AlignedRead_1__init__, /*tp_init*/
+  __pyx_pf_9csamtools_11AlignedRead___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_AlignedRead, /*tp_new*/
+  __pyx_tp_new_9csamtools_AlignedRead, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -36073,26 +33558,26 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_AlignedRead = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_Samfile __pyx_vtable_5pysam_9csamtools_Samfile;
+static struct __pyx_vtabstruct_9csamtools_Samfile __pyx_vtable_9csamtools_Samfile;
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_Samfile(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_Samfile *p;
+static PyObject *__pyx_tp_new_9csamtools_Samfile(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_Samfile *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)o);
-  p->__pyx_vtab = __pyx_vtabptr_5pysam_9csamtools_Samfile;
-  if (__pyx_pw_5pysam_9csamtools_7Samfile_1__cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_Samfile *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_Samfile;
+  if (__pyx_pf_9csamtools_7Samfile___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_Samfile(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_Samfile(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_5pysam_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);
@@ -36100,70 +33585,70 @@ static void __pyx_tp_dealloc_5pysam_9csamtools_Samfile(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7Samfile_filename(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7Samfile_8filename_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7Samfile_filename(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_8filename___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7Samfile_nreferences(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7Samfile_11nreferences_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7Samfile_nreferences(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_11nreferences___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7Samfile_references(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7Samfile_10references_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7Samfile_references(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_10references___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7Samfile_lengths(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7Samfile_7lengths_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7Samfile_lengths(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_7lengths___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7Samfile_mapped(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7Samfile_6mapped_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7Samfile_mapped(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_6mapped___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7Samfile_unmapped(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7Samfile_8unmapped_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7Samfile_unmapped(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_8unmapped___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7Samfile_text(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7Samfile_4text_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7Samfile_text(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_4text___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7Samfile_header(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7Samfile_6header_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7Samfile_header(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7Samfile_6header___get__(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_Samfile[] = {
-  {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_2_isOpen)},
-  {__Pyx_NAMESTR("_hasIndex"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_5_hasIndex, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_4_hasIndex)},
-  {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_7_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_6_open)},
-  {__Pyx_NAMESTR("gettid"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_9gettid, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_8gettid)},
-  {__Pyx_NAMESTR("getrname"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_11getrname, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_10getrname)},
-  {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_13_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_12_parseRegion)},
-  {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_15reset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_14reset)},
-  {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_17seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_16seek)},
-  {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_19tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_18tell)},
-  {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_21fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_20fetch)},
-  {__Pyx_NAMESTR("mate"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_23mate, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_22mate)},
-  {__Pyx_NAMESTR("count"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_25count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_24count)},
-  {__Pyx_NAMESTR("pileup"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_27pileup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_26pileup)},
-  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_29close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_28close)},
-  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_33write, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_32write)},
-  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_35__enter__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_34__enter__)},
-  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_37__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_36__exit__)},
-  {__Pyx_NAMESTR("_buildLine"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_39_buildLine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_38_buildLine)},
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_7Samfile_43__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_7Samfile_42__next__)},
+static PyMethodDef __pyx_methods_9csamtools_Samfile[] = {
+  {__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}
 };
 
-static struct PyGetSetDef __pyx_getsets_5pysam_9csamtools_Samfile[] = {
-  {(char *)"filename", __pyx_getprop_5pysam_9csamtools_7Samfile_filename, 0, __Pyx_DOCSTR(__pyx_k_187), 0},
-  {(char *)"nreferences", __pyx_getprop_5pysam_9csamtools_7Samfile_nreferences, 0, __Pyx_DOCSTR(__pyx_k_227), 0},
-  {(char *)"references", __pyx_getprop_5pysam_9csamtools_7Samfile_references, 0, __Pyx_DOCSTR(__pyx_k_228), 0},
-  {(char *)"lengths", __pyx_getprop_5pysam_9csamtools_7Samfile_lengths, 0, __Pyx_DOCSTR(__pyx_k_229), 0},
-  {(char *)"mapped", __pyx_getprop_5pysam_9csamtools_7Samfile_mapped, 0, __Pyx_DOCSTR(__pyx_k_230), 0},
-  {(char *)"unmapped", __pyx_getprop_5pysam_9csamtools_7Samfile_unmapped, 0, __Pyx_DOCSTR(__pyx_k_231), 0},
-  {(char *)"text", __pyx_getprop_5pysam_9csamtools_7Samfile_text, 0, __Pyx_DOCSTR(__pyx_k_232), 0},
-  {(char *)"header", __pyx_getprop_5pysam_9csamtools_7Samfile_header, 0, __Pyx_DOCSTR(__pyx_k_233), 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_Samfile[] = {
+  {(char *)"filename", __pyx_getprop_9csamtools_7Samfile_filename, 0, __Pyx_DOCSTR(__pyx_k_187), 0},
+  {(char *)"nreferences", __pyx_getprop_9csamtools_7Samfile_nreferences, 0, __Pyx_DOCSTR(__pyx_k_227), 0},
+  {(char *)"references", __pyx_getprop_9csamtools_7Samfile_references, 0, __Pyx_DOCSTR(__pyx_k_228), 0},
+  {(char *)"lengths", __pyx_getprop_9csamtools_7Samfile_lengths, 0, __Pyx_DOCSTR(__pyx_k_229), 0},
+  {(char *)"mapped", __pyx_getprop_9csamtools_7Samfile_mapped, 0, __Pyx_DOCSTR(__pyx_k_230), 0},
+  {(char *)"unmapped", __pyx_getprop_9csamtools_7Samfile_unmapped, 0, __Pyx_DOCSTR(__pyx_k_231), 0},
+  {(char *)"text", __pyx_getprop_9csamtools_7Samfile_text, 0, __Pyx_DOCSTR(__pyx_k_232), 0},
+  {(char *)"header", __pyx_getprop_9csamtools_7Samfile_header, 0, __Pyx_DOCSTR(__pyx_k_233), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -36265,12 +33750,12 @@ static PyBufferProcs __pyx_tp_as_buffer_Samfile = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_Samfile = {
+static PyTypeObject __pyx_type_9csamtools_Samfile = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.Samfile"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_Samfile), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.Samfile"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_Samfile), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_Samfile, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_Samfile, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -36295,11 +33780,11 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_Samfile = {
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_5pysam_9csamtools_7Samfile_41__iter__, /*tp_iter*/
-  __pyx_pw_5pysam_9csamtools_7Samfile_43__next__, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_Samfile, /*tp_methods*/
+  __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_5pysam_9csamtools_Samfile, /*tp_getset*/
+  __pyx_getsets_9csamtools_Samfile, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -36307,7 +33792,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_Samfile = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_Samfile, /*tp_new*/
+  __pyx_tp_new_9csamtools_Samfile, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -36321,27 +33806,27 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_Samfile = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_PileupProxy(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_9csamtools_PileupProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_PileupProxy(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_PileupProxy(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11PileupProxy_tid(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11PileupProxy_3tid_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11PileupProxy_tid(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11PileupProxy_3tid___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11PileupProxy_n(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11PileupProxy_1n_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11PileupProxy_n(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11PileupProxy_1n___get__(o);
 }
 
-static int __pyx_setprop_5pysam_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, void *x) {
   if (v) {
-    return __pyx_pw_5pysam_9csamtools_11PileupProxy_1n_3__set__(o, v);
+    return __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(o, v);
   }
   else {
     PyErr_SetString(PyExc_NotImplementedError, "__del__");
@@ -36349,23 +33834,23 @@ static int __pyx_setprop_5pysam_9csamtools_11PileupProxy_n(PyObject *o, PyObject
   }
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11PileupProxy_pos(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11PileupProxy_3pos_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11PileupProxy_3pos___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_11PileupProxy_pileups(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_11PileupProxy_7pileups_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pileups(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_11PileupProxy_7pileups___get__(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_PileupProxy[] = {
+static PyMethodDef __pyx_methods_9csamtools_PileupProxy[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_5pysam_9csamtools_PileupProxy[] = {
-  {(char *)"tid", __pyx_getprop_5pysam_9csamtools_11PileupProxy_tid, 0, __Pyx_DOCSTR(__pyx_k_234), 0},
-  {(char *)"n", __pyx_getprop_5pysam_9csamtools_11PileupProxy_n, __pyx_setprop_5pysam_9csamtools_11PileupProxy_n, __Pyx_DOCSTR(__pyx_k_235), 0},
-  {(char *)"pos", __pyx_getprop_5pysam_9csamtools_11PileupProxy_pos, 0, 0, 0},
-  {(char *)"pileups", __pyx_getprop_5pysam_9csamtools_11PileupProxy_pileups, 0, __Pyx_DOCSTR(__pyx_k_236), 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_PileupProxy[] = {
+  {(char *)"tid", __pyx_getprop_9csamtools_11PileupProxy_tid, 0, __Pyx_DOCSTR(__pyx_k_234), 0},
+  {(char *)"n", __pyx_getprop_9csamtools_11PileupProxy_n, __pyx_setprop_9csamtools_11PileupProxy_n, __Pyx_DOCSTR(__pyx_k_235), 0},
+  {(char *)"pos", __pyx_getprop_9csamtools_11PileupProxy_pos, 0, 0, 0},
+  {(char *)"pileups", __pyx_getprop_9csamtools_11PileupProxy_pileups, 0, __Pyx_DOCSTR(__pyx_k_236), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -36467,12 +33952,12 @@ static PyBufferProcs __pyx_tp_as_buffer_PileupProxy = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_PileupProxy = {
+static PyTypeObject __pyx_type_9csamtools_PileupProxy = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.PileupProxy"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_PileupProxy), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.PileupProxy"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_PileupProxy), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_PileupProxy, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_PileupProxy, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -36487,7 +33972,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_PileupProxy = {
   &__pyx_tp_as_mapping_PileupProxy, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pw_5pysam_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*/
@@ -36499,17 +33984,17 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_PileupProxy = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_PileupProxy, /*tp_methods*/
+  __pyx_methods_9csamtools_PileupProxy, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_5pysam_9csamtools_PileupProxy, /*tp_getset*/
+  __pyx_getsets_9csamtools_PileupProxy, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_5pysam_9csamtools_11PileupProxy_1__init__, /*tp_init*/
+  __pyx_pf_9csamtools_11PileupProxy___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_PileupProxy, /*tp_new*/
+  __pyx_tp_new_9csamtools_PileupProxy, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -36523,79 +34008,79 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_PileupProxy = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_PileupRead(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_PileupRead *p;
+static PyObject *__pyx_tp_new_9csamtools_PileupRead(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_PileupRead *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_PileupRead *)o);
-  p->_alignment = ((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
+  p = ((struct __pyx_obj_9csamtools_PileupRead *)o);
+  p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_PileupRead(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_PileupRead *p = (struct __pyx_obj_5pysam_9csamtools_PileupRead *)o;
-  Py_CLEAR(p->_alignment);
+static void __pyx_tp_dealloc_9csamtools_PileupRead(PyObject *o) {
+  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
+  Py_XDECREF(((PyObject *)p->_alignment));
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_5pysam_9csamtools_PileupRead(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools_PileupRead(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_5pysam_9csamtools_PileupRead *p = (struct __pyx_obj_5pysam_9csamtools_PileupRead *)o;
+  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
   if (p->_alignment) {
     e = (*v)(((PyObject*)p->_alignment), a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_5pysam_9csamtools_PileupRead(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_PileupRead *p = (struct __pyx_obj_5pysam_9csamtools_PileupRead *)o;
+static int __pyx_tp_clear_9csamtools_PileupRead(PyObject *o) {
+  struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->_alignment);
-  p->_alignment = ((struct __pyx_obj_5pysam_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
+  p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_10PileupRead_alignment(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_10PileupRead_9alignment_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_alignment(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_9alignment___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_10PileupRead_qpos(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_10PileupRead_4qpos_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_qpos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_4qpos___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_10PileupRead_indel(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_10PileupRead_5indel_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_indel(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_5indel___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_10PileupRead_is_del(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_10PileupRead_6is_del_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_del(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_6is_del___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_10PileupRead_is_head(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_10PileupRead_7is_head_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_head(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_7is_head___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_10PileupRead_is_tail(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_10PileupRead_7is_tail_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_tail(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_7is_tail___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_10PileupRead_level(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_10PileupRead_5level_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_10PileupRead_level(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_10PileupRead_5level___get__(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_PileupRead[] = {
+static PyMethodDef __pyx_methods_9csamtools_PileupRead[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_5pysam_9csamtools_PileupRead[] = {
-  {(char *)"alignment", __pyx_getprop_5pysam_9csamtools_10PileupRead_alignment, 0, __Pyx_DOCSTR(__pyx_k_237), 0},
-  {(char *)"qpos", __pyx_getprop_5pysam_9csamtools_10PileupRead_qpos, 0, __Pyx_DOCSTR(__pyx_k_238), 0},
-  {(char *)"indel", __pyx_getprop_5pysam_9csamtools_10PileupRead_indel, 0, __Pyx_DOCSTR(__pyx_k_239), 0},
-  {(char *)"is_del", __pyx_getprop_5pysam_9csamtools_10PileupRead_is_del, 0, __Pyx_DOCSTR(__pyx_k_240), 0},
-  {(char *)"is_head", __pyx_getprop_5pysam_9csamtools_10PileupRead_is_head, 0, 0, 0},
-  {(char *)"is_tail", __pyx_getprop_5pysam_9csamtools_10PileupRead_is_tail, 0, 0, 0},
-  {(char *)"level", __pyx_getprop_5pysam_9csamtools_10PileupRead_level, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_PileupRead[] = {
+  {(char *)"alignment", __pyx_getprop_9csamtools_10PileupRead_alignment, 0, __Pyx_DOCSTR(__pyx_k_237), 0},
+  {(char *)"qpos", __pyx_getprop_9csamtools_10PileupRead_qpos, 0, __Pyx_DOCSTR(__pyx_k_238), 0},
+  {(char *)"indel", __pyx_getprop_9csamtools_10PileupRead_indel, 0, __Pyx_DOCSTR(__pyx_k_239), 0},
+  {(char *)"is_del", __pyx_getprop_9csamtools_10PileupRead_is_del, 0, __Pyx_DOCSTR(__pyx_k_240), 0},
+  {(char *)"is_head", __pyx_getprop_9csamtools_10PileupRead_is_head, 0, 0, 0},
+  {(char *)"is_tail", __pyx_getprop_9csamtools_10PileupRead_is_tail, 0, 0, 0},
+  {(char *)"level", __pyx_getprop_9csamtools_10PileupRead_level, 0, 0, 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -36697,12 +34182,12 @@ static PyBufferProcs __pyx_tp_as_buffer_PileupRead = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_PileupRead = {
+static PyTypeObject __pyx_type_9csamtools_PileupRead = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.PileupRead"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_PileupRead), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.PileupRead"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_PileupRead), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_PileupRead, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_PileupRead, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -36717,29 +34202,29 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_PileupRead = {
   &__pyx_tp_as_mapping_PileupRead, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pw_5pysam_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*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("PileupRead()\nA read aligned to a column.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_5pysam_9csamtools_PileupRead, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools_PileupRead, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools_PileupRead, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_PileupRead, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_PileupRead, /*tp_methods*/
+  __pyx_methods_9csamtools_PileupRead, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_5pysam_9csamtools_PileupRead, /*tp_getset*/
+  __pyx_getsets_9csamtools_PileupRead, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_5pysam_9csamtools_10PileupRead_1__init__, /*tp_init*/
+  __pyx_pf_9csamtools_10PileupRead___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_PileupRead, /*tp_new*/
+  __pyx_tp_new_9csamtools_PileupRead, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -36753,17 +34238,17 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_PileupRead = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IteratorRow(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_9csamtools_IteratorRow(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_IteratorRow(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_IteratorRow(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IteratorRow[] = {
+static PyMethodDef __pyx_methods_9csamtools_IteratorRow[] = {
   {0, 0, 0, 0}
 };
 
@@ -36865,12 +34350,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorRow = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRow = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRow = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IteratorRow"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IteratorRow), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRow"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRow), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRow, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRow, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -36897,7 +34382,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRow = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IteratorRow, /*tp_methods*/
+  __pyx_methods_9csamtools_IteratorRow, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -36907,7 +34392,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRow = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IteratorRow, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRow, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -36920,58 +34405,62 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRow = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowRegion __pyx_vtable_5pysam_9csamtools_IteratorRowRegion;
+static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion __pyx_vtable_9csamtools_IteratorRowRegion;
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IteratorRowRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *p;
-  PyObject *o = __pyx_tp_new_5pysam_9csamtools_IteratorRow(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRowRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorRowRegion *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)o);
-  p->__pyx_vtab = __pyx_vtabptr_5pysam_9csamtools_IteratorRowRegion;
-  p->samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pw_5pysam_9csamtools_17IteratorRowRegion_1__cinit__(o, a, k) < 0) {
+  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_pf_9csamtools_17IteratorRowRegion___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_IteratorRowRegion(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)o;
+static void __pyx_tp_dealloc_9csamtools_IteratorRowRegion(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_5pysam_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);
   }
-  Py_CLEAR(p->samfile);
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRow(o);
+  Py_XDECREF(((PyObject *)p->samfile));
+  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
 }
 
-static int __pyx_tp_traverse_5pysam_9csamtools_IteratorRowRegion(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools_IteratorRowRegion(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)o;
-  e = ((likely(__pyx_ptype_5pysam_9csamtools_IteratorRow)) ? ((__pyx_ptype_5pysam_9csamtools_IteratorRow->tp_traverse) ? __pyx_ptype_5pysam_9csamtools_IteratorRow->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_9csamtools_IteratorRowRegion)); if (e) return e;
+  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
+    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
+  }
   if (p->samfile) {
     e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_5pysam_9csamtools_IteratorRowRegion(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)o;
+static int __pyx_tp_clear_9csamtools_IteratorRowRegion(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
   PyObject* tmp;
-  if (likely(__pyx_ptype_5pysam_9csamtools_IteratorRow)) { if (__pyx_ptype_5pysam_9csamtools_IteratorRow->tp_clear) __pyx_ptype_5pysam_9csamtools_IteratorRow->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5pysam_9csamtools_IteratorRowRegion);
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
+    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
+  }
   tmp = ((PyObject*)p->samfile);
-  p->samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IteratorRowRegion[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_17IteratorRowRegion_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_17IteratorRowRegion_4__next__)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorRowRegion[] = {
+  {__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}
 };
 
@@ -37073,12 +34562,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorRowRegion = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowRegion = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRowRegion = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IteratorRowRegion"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRowRegion"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRowRegion), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRowRegion, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRowRegion, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -37099,13 +34588,13 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowRegion = {
   &__pyx_tp_as_buffer_IteratorRowRegion, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("*(Samfile samfile, int tid, int beg, int end, int reopen = True )*\n\n    iterate over mapped reads in a region.\n\n    By default, the file is re-openend to avoid conflicts between\n    multiple iterators working on the same file. Set *reopen* = False\n    to not re-open *samfile*.\n\n    The samtools iterators assume that the file\n    position between iterations do not change.\n    As a consequence, no two iterators can work\n    on the same file. To permit this, each  [...]
-  __pyx_tp_traverse_5pysam_9csamtools_IteratorRowRegion, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools_IteratorRowRegion, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools_IteratorRowRegion, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorRowRegion, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_3__iter__, /*tp_iter*/
-  __pyx_pw_5pysam_9csamtools_17IteratorRowRegion_5__next__, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IteratorRowRegion, /*tp_methods*/
+  __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*/
   0, /*tp_base*/
@@ -37115,7 +34604,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowRegion = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IteratorRowRegion, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRowRegion, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -37128,35 +34617,35 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowRegion = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowAll __pyx_vtable_5pysam_9csamtools_IteratorRowAll;
+static struct __pyx_vtabstruct_9csamtools_IteratorRowAll __pyx_vtable_9csamtools_IteratorRowAll;
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IteratorRowAll(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *p;
-  PyObject *o = __pyx_tp_new_5pysam_9csamtools_IteratorRow(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRowAll(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorRowAll *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *)o);
-  p->__pyx_vtab = __pyx_vtabptr_5pysam_9csamtools_IteratorRowAll;
-  if (__pyx_pw_5pysam_9csamtools_14IteratorRowAll_1__cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorRowAll *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowAll;
+  if (__pyx_pf_9csamtools_14IteratorRowAll___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_IteratorRowAll(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_IteratorRowAll(PyObject *o) {
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_5pysam_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);
   }
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRow(o);
+  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IteratorRowAll[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_14IteratorRowAll_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_14IteratorRowAll_4__next__)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorRowAll[] = {
+  {__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}
 };
 
@@ -37258,12 +34747,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAll = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowAll = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRowAll = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IteratorRowAll"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRowAll"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRowAll), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRowAll, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRowAll, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -37288,9 +34777,9 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowAll = {
   0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_5pysam_9csamtools_14IteratorRowAll_3__iter__, /*tp_iter*/
-  __pyx_pw_5pysam_9csamtools_14IteratorRowAll_5__next__, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IteratorRowAll, /*tp_methods*/
+  __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*/
   0, /*tp_base*/
@@ -37300,7 +34789,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowAll = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IteratorRowAll, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRowAll, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -37314,30 +34803,32 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowAll = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IteratorRowAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *p;
-  PyObject *o = __pyx_tp_new_5pysam_9csamtools_IteratorRow(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRowAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *)o);
-  p->samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  p->rowiter = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
-  if (__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_1__cinit__(o, a, k) < 0) {
+  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_pf_9csamtools_18IteratorRowAllRefs___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_IteratorRowAllRefs(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *)o;
-  Py_CLEAR(p->samfile);
-  Py_CLEAR(p->rowiter);
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRow(o);
+static void __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
+  Py_XDECREF(((PyObject *)p->samfile));
+  Py_XDECREF(((PyObject *)p->rowiter));
+  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
 }
 
-static int __pyx_tp_traverse_5pysam_9csamtools_IteratorRowAllRefs(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools_IteratorRowAllRefs(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *)o;
-  e = ((likely(__pyx_ptype_5pysam_9csamtools_IteratorRow)) ? ((__pyx_ptype_5pysam_9csamtools_IteratorRow->tp_traverse) ? __pyx_ptype_5pysam_9csamtools_IteratorRow->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_9csamtools_IteratorRowAllRefs)); if (e) return e;
+  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
+    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
+  }
   if (p->samfile) {
     e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
   }
@@ -37347,22 +34838,24 @@ static int __pyx_tp_traverse_5pysam_9csamtools_IteratorRowAllRefs(PyObject *o, v
   return 0;
 }
 
-static int __pyx_tp_clear_5pysam_9csamtools_IteratorRowAllRefs(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs *)o;
+static int __pyx_tp_clear_9csamtools_IteratorRowAllRefs(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
   PyObject* tmp;
-  if (likely(__pyx_ptype_5pysam_9csamtools_IteratorRow)) { if (__pyx_ptype_5pysam_9csamtools_IteratorRow->tp_clear) __pyx_ptype_5pysam_9csamtools_IteratorRow->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5pysam_9csamtools_IteratorRowAllRefs);
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
+    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
+  }
   tmp = ((PyObject*)p->samfile);
-  p->samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   tmp = ((PyObject*)p->rowiter);
-  p->rowiter = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
+  p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IteratorRowAllRefs[] = {
-  {__Pyx_NAMESTR("nextiter"), (PyCFunction)__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_3nextiter, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_18IteratorRowAllRefs_2nextiter)},
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_7__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_18IteratorRowAllRefs_6__next__)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorRowAllRefs[] = {
+  {__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}
 };
 
@@ -37464,12 +34957,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAllRefs = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowAllRefs = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IteratorRowAllRefs"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IteratorRowAllRefs), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRowAllRefs"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRowAllRefs), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRowAllRefs, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -37490,13 +34983,13 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowAllRefs = {
   &__pyx_tp_as_buffer_IteratorRowAllRefs, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("iterates over all mapped reads by chaining iterators over each reference\n    "), /*tp_doc*/
-  __pyx_tp_traverse_5pysam_9csamtools_IteratorRowAllRefs, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools_IteratorRowAllRefs, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools_IteratorRowAllRefs, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorRowAllRefs, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_5__iter__, /*tp_iter*/
-  __pyx_pw_5pysam_9csamtools_18IteratorRowAllRefs_7__next__, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IteratorRowAllRefs, /*tp_methods*/
+  __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*/
   0, /*tp_base*/
@@ -37506,7 +34999,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowAllRefs = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IteratorRowAllRefs, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRowAllRefs, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -37519,58 +35012,62 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowAllRefs = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorRowSelection __pyx_vtable_5pysam_9csamtools_IteratorRowSelection;
+static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection __pyx_vtable_9csamtools_IteratorRowSelection;
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IteratorRowSelection(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *p;
-  PyObject *o = __pyx_tp_new_5pysam_9csamtools_IteratorRow(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorRowSelection(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorRowSelection *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *)o);
-  p->__pyx_vtab = __pyx_vtabptr_5pysam_9csamtools_IteratorRowSelection;
+  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_5pysam_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;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_IteratorRowSelection(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *)o;
+static void __pyx_tp_dealloc_9csamtools_IteratorRowSelection(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_5pysam_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);
   }
-  Py_CLEAR(p->positions);
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRow(o);
+  Py_XDECREF(p->positions);
+  __pyx_tp_dealloc_9csamtools_IteratorRow(o);
 }
 
-static int __pyx_tp_traverse_5pysam_9csamtools_IteratorRowSelection(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools_IteratorRowSelection(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *)o;
-  e = ((likely(__pyx_ptype_5pysam_9csamtools_IteratorRow)) ? ((__pyx_ptype_5pysam_9csamtools_IteratorRow->tp_traverse) ? __pyx_ptype_5pysam_9csamtools_IteratorRow->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_9csamtools_IteratorRowSelection)); if (e) return e;
+  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
+    e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
+  }
   if (p->positions) {
     e = (*v)(p->positions, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_5pysam_9csamtools_IteratorRowSelection(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *)o;
+static int __pyx_tp_clear_9csamtools_IteratorRowSelection(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
   PyObject* tmp;
-  if (likely(__pyx_ptype_5pysam_9csamtools_IteratorRow)) { if (__pyx_ptype_5pysam_9csamtools_IteratorRow->tp_clear) __pyx_ptype_5pysam_9csamtools_IteratorRow->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5pysam_9csamtools_IteratorRowSelection);
+  if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
+    __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
+  }
   tmp = ((PyObject*)p->positions);
   p->positions = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IteratorRowSelection[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_20IteratorRowSelection_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_20IteratorRowSelection_4__next__)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorRowSelection[] = {
+  {__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}
 };
 
@@ -37672,12 +35169,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorRowSelection = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowSelection = {
+static PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IteratorRowSelection"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorRowSelection"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorRowSelection), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorRowSelection, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorRowSelection, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -37698,13 +35195,13 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowSelection = {
   &__pyx_tp_as_buffer_IteratorRowSelection, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("*(Samfile samfile)*\n\n    iterate over reads in *samfile* at a given list of file positions.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_5pysam_9csamtools_IteratorRowSelection, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools_IteratorRowSelection, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools_IteratorRowSelection, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorRowSelection, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_3__iter__, /*tp_iter*/
-  __pyx_pw_5pysam_9csamtools_20IteratorRowSelection_5__next__, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IteratorRowSelection, /*tp_methods*/
+  __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*/
   0, /*tp_base*/
@@ -37714,7 +35211,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowSelection = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IteratorRowSelection, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorRowSelection, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -37727,45 +35224,45 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorRowSelection = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumn __pyx_vtable_5pysam_9csamtools_IteratorColumn;
+static struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_vtable_9csamtools_IteratorColumn;
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IteratorColumn(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorColumn *p;
+static PyObject *__pyx_tp_new_9csamtools_IteratorColumn(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorColumn *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)o);
-  p->__pyx_vtab = __pyx_vtabptr_5pysam_9csamtools_IteratorColumn;
-  p->iter = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
-  p->samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
-  p->fastafile = ((struct __pyx_obj_5pysam_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
+  p = ((struct __pyx_obj_9csamtools_IteratorColumn *)o);
+  p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorColumn;
+  p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
+  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_5pysam_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;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_IteratorColumn(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorColumn *p = (struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)o;
+static void __pyx_tp_dealloc_9csamtools_IteratorColumn(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_5pysam_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);
   }
-  Py_CLEAR(p->iter);
-  Py_CLEAR(p->samfile);
-  Py_CLEAR(p->fastafile);
-  Py_CLEAR(p->stepper);
+  Py_XDECREF(((PyObject *)p->iter));
+  Py_XDECREF(((PyObject *)p->samfile));
+  Py_XDECREF(((PyObject *)p->fastafile));
+  Py_XDECREF(p->stepper);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_5pysam_9csamtools_IteratorColumn(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools_IteratorColumn(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_5pysam_9csamtools_IteratorColumn *p = (struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)o;
+  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
   if (p->iter) {
     e = (*v)(((PyObject*)p->iter), a); if (e) return e;
   }
@@ -37781,17 +35278,17 @@ static int __pyx_tp_traverse_5pysam_9csamtools_IteratorColumn(PyObject *o, visit
   return 0;
 }
 
-static int __pyx_tp_clear_5pysam_9csamtools_IteratorColumn(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorColumn *p = (struct __pyx_obj_5pysam_9csamtools_IteratorColumn *)o;
+static int __pyx_tp_clear_9csamtools_IteratorColumn(PyObject *o) {
+  struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->iter);
-  p->iter = ((struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
+  p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   tmp = ((PyObject*)p->samfile);
-  p->samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   tmp = ((PyObject*)p->fastafile);
-  p->fastafile = ((struct __pyx_obj_5pysam_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
+  p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   tmp = ((PyObject*)p->stepper);
   p->stepper = Py_None; Py_INCREF(Py_None);
@@ -37799,18 +35296,18 @@ static int __pyx_tp_clear_5pysam_9csamtools_IteratorColumn(PyObject *o) {
   return 0;
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_14IteratorColumn_seq_len(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_14IteratorColumn_7seq_len_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_14IteratorColumn_seq_len(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IteratorColumn[] = {
-  {__Pyx_NAMESTR("addReference"), (PyCFunction)__pyx_pw_5pysam_9csamtools_14IteratorColumn_5addReference, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_14IteratorColumn_4addReference)},
-  {__Pyx_NAMESTR("hasReference"), (PyCFunction)__pyx_pw_5pysam_9csamtools_14IteratorColumn_7hasReference, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_14IteratorColumn_6hasReference)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorColumn[] = {
+  {__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}
 };
 
-static struct PyGetSetDef __pyx_getsets_5pysam_9csamtools_IteratorColumn[] = {
-  {(char *)"seq_len", __pyx_getprop_5pysam_9csamtools_14IteratorColumn_seq_len, 0, __Pyx_DOCSTR(__pyx_k_241), 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_IteratorColumn[] = {
+  {(char *)"seq_len", __pyx_getprop_9csamtools_14IteratorColumn_seq_len, 0, __Pyx_DOCSTR(__pyx_k_241), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -37912,12 +35409,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorColumn = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumn = {
+static PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IteratorColumn"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IteratorColumn), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorColumn"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorColumn), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorColumn, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -37938,15 +35435,15 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumn = {
   &__pyx_tp_as_buffer_IteratorColumn, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("abstract base class for iterators over columns.\n\n    IteratorColumn objects wrap the pileup functionality of samtools.\n\n    For reasons of efficiency, the iterator points to the current\n    pileup buffer. The pileup buffer is updated at every iteration.\n    This might cause some unexpected behavious. For example,\n    consider the conversion to a list::\n\n       f = Samfile(\"file.bam\", \"rb\")\n       result = list( f.pileup() )\n\n    Here, ``result`` will conta [...]
-  __pyx_tp_traverse_5pysam_9csamtools_IteratorColumn, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools_IteratorColumn, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  __pyx_pw_5pysam_9csamtools_14IteratorColumn_3__iter__, /*tp_iter*/
+  __pyx_pf_9csamtools_14IteratorColumn_1__iter__, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IteratorColumn, /*tp_methods*/
+  __pyx_methods_9csamtools_IteratorColumn, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_5pysam_9csamtools_IteratorColumn, /*tp_getset*/
+  __pyx_getsets_9csamtools_IteratorColumn, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -37954,7 +35451,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumn = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IteratorColumn, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorColumn, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -37967,22 +35464,22 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumn = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnRegion __pyx_vtable_5pysam_9csamtools_IteratorColumnRegion;
+static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion __pyx_vtable_9csamtools_IteratorColumnRegion;
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IteratorColumnRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion *p;
-  PyObject *o = __pyx_tp_new_5pysam_9csamtools_IteratorColumn(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorColumnRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorColumnRegion *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion *)o);
-  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumn*)__pyx_vtabptr_5pysam_9csamtools_IteratorColumnRegion;
-  if (__pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_1__cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)o);
+  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnRegion;
+  if (__pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IteratorColumnRegion[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_20IteratorColumnRegion_2__next__)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorColumnRegion[] = {
+  {__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}
 };
 
@@ -38084,12 +35581,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnRegion = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumnRegion = {
+static PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IteratorColumnRegion"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IteratorColumnRegion), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorColumnRegion"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorColumnRegion), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorColumn, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -38110,17 +35607,13 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumnRegion = {
   &__pyx_tp_as_buffer_IteratorColumnRegion, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("iterates over a region only.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_5pysam_9csamtools_IteratorColumn, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools_IteratorColumn, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_pw_5pysam_9csamtools_14IteratorColumn_3__iter__, /*tp_iter*/
-  #else
   0, /*tp_iter*/
-  #endif
-  __pyx_pw_5pysam_9csamtools_20IteratorColumnRegion_3__next__, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IteratorColumnRegion, /*tp_methods*/
+  __pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorColumnRegion, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -38130,7 +35623,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumnRegion = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IteratorColumnRegion, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorColumnRegion, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -38143,22 +35636,22 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumnRegion = {
   0, /*tp_version_tag*/
   #endif
 };
-static struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumnAllRefs __pyx_vtable_5pysam_9csamtools_IteratorColumnAllRefs;
+static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs __pyx_vtable_9csamtools_IteratorColumnAllRefs;
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IteratorColumnAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs *p;
-  PyObject *o = __pyx_tp_new_5pysam_9csamtools_IteratorColumn(t, a, k);
+static PyObject *__pyx_tp_new_9csamtools_IteratorColumnAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IteratorColumnAllRefs *p;
+  PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs *)o);
-  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5pysam_9csamtools_IteratorColumn*)__pyx_vtabptr_5pysam_9csamtools_IteratorColumnAllRefs;
-  if (__pyx_pw_5pysam_9csamtools_21IteratorColumnAllRefs_1__cinit__(o, a, k) < 0) {
+  p = ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)o);
+  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
+  if (__pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(o, a, k) < 0) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IteratorColumnAllRefs[] = {
-  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_5pysam_9csamtools_21IteratorColumnAllRefs_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__)},
+static PyMethodDef __pyx_methods_9csamtools_IteratorColumnAllRefs[] = {
+  {__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}
 };
 
@@ -38260,12 +35753,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnAllRefs = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumnAllRefs = {
+static PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IteratorColumnAllRefs"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IteratorColumnAllRefs), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IteratorColumnAllRefs"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IteratorColumnAllRefs), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IteratorColumn, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -38286,17 +35779,13 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumnAllRefs = {
   &__pyx_tp_as_buffer_IteratorColumnAllRefs, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("iterates over all columns by chaining iterators over each reference\n    "), /*tp_doc*/
-  __pyx_tp_traverse_5pysam_9csamtools_IteratorColumn, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools_IteratorColumn, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_pw_5pysam_9csamtools_14IteratorColumn_3__iter__, /*tp_iter*/
-  #else
   0, /*tp_iter*/
-  #endif
-  __pyx_pw_5pysam_9csamtools_21IteratorColumnAllRefs_3__next__, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IteratorColumnAllRefs, /*tp_methods*/
+  __pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, /*tp_iternext*/
+  __pyx_methods_9csamtools_IteratorColumnAllRefs, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -38306,7 +35795,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumnAllRefs = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IteratorColumnAllRefs, /*tp_new*/
+  __pyx_tp_new_9csamtools_IteratorColumnAllRefs, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -38320,35 +35809,35 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IteratorColumnAllRefs = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_IndexedReads(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools_IndexedReads *p;
+static PyObject *__pyx_tp_new_9csamtools_IndexedReads(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_9csamtools_IndexedReads *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools_IndexedReads *)o);
-  p->samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  p = ((struct __pyx_obj_9csamtools_IndexedReads *)o);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
   p->index = Py_None; Py_INCREF(Py_None);
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_IndexedReads(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IndexedReads *p = (struct __pyx_obj_5pysam_9csamtools_IndexedReads *)o;
+static void __pyx_tp_dealloc_9csamtools_IndexedReads(PyObject *o) {
+  struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_pw_5pysam_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);
   }
-  Py_CLEAR(p->samfile);
-  Py_CLEAR(p->index);
+  Py_XDECREF(((PyObject *)p->samfile));
+  Py_XDECREF(p->index);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_5pysam_9csamtools_IndexedReads(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools_IndexedReads(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_5pysam_9csamtools_IndexedReads *p = (struct __pyx_obj_5pysam_9csamtools_IndexedReads *)o;
+  struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
   if (p->samfile) {
     e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
   }
@@ -38358,11 +35847,11 @@ static int __pyx_tp_traverse_5pysam_9csamtools_IndexedReads(PyObject *o, visitpr
   return 0;
 }
 
-static int __pyx_tp_clear_5pysam_9csamtools_IndexedReads(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools_IndexedReads *p = (struct __pyx_obj_5pysam_9csamtools_IndexedReads *)o;
+static int __pyx_tp_clear_9csamtools_IndexedReads(PyObject *o) {
+  struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
   PyObject* tmp;
   tmp = ((PyObject*)p->samfile);
-  p->samfile = ((struct __pyx_obj_5pysam_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
+  p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   tmp = ((PyObject*)p->index);
   p->index = Py_None; Py_INCREF(Py_None);
@@ -38370,9 +35859,9 @@ static int __pyx_tp_clear_5pysam_9csamtools_IndexedReads(PyObject *o) {
   return 0;
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_IndexedReads[] = {
-  {__Pyx_NAMESTR("build"), (PyCFunction)__pyx_pw_5pysam_9csamtools_12IndexedReads_3build, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_12IndexedReads_2build)},
-  {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pw_5pysam_9csamtools_12IndexedReads_5find, METH_O, __Pyx_DOCSTR(__pyx_doc_5pysam_9csamtools_12IndexedReads_4find)},
+static PyMethodDef __pyx_methods_9csamtools_IndexedReads[] = {
+  {__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}
 };
 
@@ -38474,12 +35963,12 @@ static PyBufferProcs __pyx_tp_as_buffer_IndexedReads = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_IndexedReads = {
+static PyTypeObject __pyx_type_9csamtools_IndexedReads = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.IndexedReads"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_IndexedReads), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.IndexedReads"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_IndexedReads), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_IndexedReads, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_IndexedReads, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -38500,13 +35989,13 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IndexedReads = {
   &__pyx_tp_as_buffer_IndexedReads, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("IndexedReads(Samfile samfile, int reopen=True)\nindex a bamfile by read.\n\n    The index is kept in memory.\n\n    By default, the file is re-openend to avoid conflicts if\n    multiple operators work on the same file. Set *reopen* = False\n    to not re-open *samfile*.\n    "), /*tp_doc*/
-  __pyx_tp_traverse_5pysam_9csamtools_IndexedReads, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools_IndexedReads, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools_IndexedReads, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools_IndexedReads, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_IndexedReads, /*tp_methods*/
+  __pyx_methods_9csamtools_IndexedReads, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -38514,9 +36003,9 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IndexedReads = {
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_pw_5pysam_9csamtools_12IndexedReads_1__init__, /*tp_init*/
+  __pyx_pf_9csamtools_12IndexedReads___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_IndexedReads, /*tp_new*/
+  __pyx_tp_new_9csamtools_IndexedReads, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -38530,61 +36019,61 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_IndexedReads = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools_SNPCall(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_9csamtools_SNPCall(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools_SNPCall(PyObject *o) {
+static void __pyx_tp_dealloc_9csamtools_SNPCall(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7SNPCall_tid(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7SNPCall_3tid_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_tid(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_3tid___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7SNPCall_pos(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7SNPCall_3pos_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_pos(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_3pos___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7SNPCall_reference_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7SNPCall_14reference_base_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_reference_base(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_14reference_base___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7SNPCall_genotype(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7SNPCall_8genotype_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_genotype(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_8genotype___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7SNPCall_consensus_quality(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7SNPCall_17consensus_quality_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_consensus_quality(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7SNPCall_snp_quality(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7SNPCall_11snp_quality_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_snp_quality(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7SNPCall_mapping_quality(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7SNPCall_15mapping_quality_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_mapping_quality(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_9csamtools_7SNPCall_coverage(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_pw_5pysam_9csamtools_7SNPCall_8coverage_1__get__(o);
+static PyObject *__pyx_getprop_9csamtools_7SNPCall_coverage(PyObject *o, void *x) {
+  return __pyx_pf_9csamtools_7SNPCall_8coverage___get__(o);
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools_SNPCall[] = {
+static PyMethodDef __pyx_methods_9csamtools_SNPCall[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_5pysam_9csamtools_SNPCall[] = {
-  {(char *)"tid", __pyx_getprop_5pysam_9csamtools_7SNPCall_tid, 0, __Pyx_DOCSTR(__pyx_k_234), 0},
-  {(char *)"pos", __pyx_getprop_5pysam_9csamtools_7SNPCall_pos, 0, __Pyx_DOCSTR(__pyx_k_242), 0},
-  {(char *)"reference_base", __pyx_getprop_5pysam_9csamtools_7SNPCall_reference_base, 0, __Pyx_DOCSTR(__pyx_k_243), 0},
-  {(char *)"genotype", __pyx_getprop_5pysam_9csamtools_7SNPCall_genotype, 0, __Pyx_DOCSTR(__pyx_k_244), 0},
-  {(char *)"consensus_quality", __pyx_getprop_5pysam_9csamtools_7SNPCall_consensus_quality, 0, __Pyx_DOCSTR(__pyx_k_245), 0},
-  {(char *)"snp_quality", __pyx_getprop_5pysam_9csamtools_7SNPCall_snp_quality, 0, __Pyx_DOCSTR(__pyx_k_246), 0},
-  {(char *)"mapping_quality", __pyx_getprop_5pysam_9csamtools_7SNPCall_mapping_quality, 0, __Pyx_DOCSTR(__pyx_k_247), 0},
-  {(char *)"coverage", __pyx_getprop_5pysam_9csamtools_7SNPCall_coverage, 0, __Pyx_DOCSTR(__pyx_k_248), 0},
+static struct PyGetSetDef __pyx_getsets_9csamtools_SNPCall[] = {
+  {(char *)"tid", __pyx_getprop_9csamtools_7SNPCall_tid, 0, __Pyx_DOCSTR(__pyx_k_234), 0},
+  {(char *)"pos", __pyx_getprop_9csamtools_7SNPCall_pos, 0, __Pyx_DOCSTR(__pyx_k_242), 0},
+  {(char *)"reference_base", __pyx_getprop_9csamtools_7SNPCall_reference_base, 0, __Pyx_DOCSTR(__pyx_k_243), 0},
+  {(char *)"genotype", __pyx_getprop_9csamtools_7SNPCall_genotype, 0, __Pyx_DOCSTR(__pyx_k_244), 0},
+  {(char *)"consensus_quality", __pyx_getprop_9csamtools_7SNPCall_consensus_quality, 0, __Pyx_DOCSTR(__pyx_k_245), 0},
+  {(char *)"snp_quality", __pyx_getprop_9csamtools_7SNPCall_snp_quality, 0, __Pyx_DOCSTR(__pyx_k_246), 0},
+  {(char *)"mapping_quality", __pyx_getprop_9csamtools_7SNPCall_mapping_quality, 0, __Pyx_DOCSTR(__pyx_k_247), 0},
+  {(char *)"coverage", __pyx_getprop_9csamtools_7SNPCall_coverage, 0, __Pyx_DOCSTR(__pyx_k_248), 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -38686,12 +36175,12 @@ static PyBufferProcs __pyx_tp_as_buffer_SNPCall = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools_SNPCall = {
+static PyTypeObject __pyx_type_9csamtools_SNPCall = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.SNPCall"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools_SNPCall), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.SNPCall"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools_SNPCall), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools_SNPCall, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools_SNPCall, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -38706,7 +36195,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_SNPCall = {
   &__pyx_tp_as_mapping_SNPCall, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_pw_5pysam_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*/
@@ -38718,9 +36207,9 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_SNPCall = {
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools_SNPCall, /*tp_methods*/
+  __pyx_methods_9csamtools_SNPCall, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_5pysam_9csamtools_SNPCall, /*tp_getset*/
+  __pyx_getsets_9csamtools_SNPCall, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -38728,7 +36217,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_SNPCall = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools_SNPCall, /*tp_new*/
+  __pyx_tp_new_9csamtools_SNPCall, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -38742,11 +36231,221 @@ static PyTypeObject __pyx_type_5pysam_9csamtools_SNPCall = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools___pyx_scope_struct__genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *p;
+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_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *)o);
+  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 = __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;
   p->__pyx_v_y = 0;
   p->__pyx_t_0 = 0;
@@ -38754,18 +36453,19 @@ static PyObject *__pyx_tp_new_5pysam_9csamtools___pyx_scope_struct__genexpr(PyTy
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools___pyx_scope_struct__genexpr(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *)o;
-  Py_CLEAR(p->__pyx_v_x);
-  Py_CLEAR(p->__pyx_v_y);
-  Py_CLEAR(p->__pyx_t_0);
-  Py_CLEAR(p->__pyx_t_1);
-  (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_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;
+  Py_XDECREF(p->__pyx_v_x);
+  Py_XDECREF(p->__pyx_v_y);
+  Py_XDECREF(p->__pyx_t_0);
+  Py_XDECREF(p->__pyx_t_1);
+  __pyx_tp_dealloc_9csamtools___pyx_Generator(o);
 }
 
-static int __pyx_tp_traverse_5pysam_9csamtools___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *)o;
+  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;
   }
@@ -38781,9 +36481,10 @@ static int __pyx_tp_traverse_5pysam_9csamtools___pyx_scope_struct__genexpr(PyObj
   return 0;
 }
 
-static int __pyx_tp_clear_5pysam_9csamtools___pyx_scope_struct__genexpr(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr *)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);
@@ -38799,7 +36500,7 @@ static int __pyx_tp_clear_5pysam_9csamtools___pyx_scope_struct__genexpr(PyObject
   return 0;
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools___pyx_scope_struct__genexpr[] = {
+static PyMethodDef __pyx_methods_9csamtools___pyx_scope_struct__genexpr[] = {
   {0, 0, 0, 0}
 };
 
@@ -38901,12 +36602,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__genexpr = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools___pyx_scope_struct__genexpr = {
+static PyTypeObject __pyx_type_9csamtools___pyx_scope_struct__genexpr = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.__pyx_scope_struct__genexpr"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct__genexpr), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.__pyx_scope_struct__genexpr"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools___pyx_scope_struct__genexpr, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools___pyx_scope_struct__genexpr, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -38927,13 +36628,13 @@ static PyTypeObject __pyx_type_5pysam_9csamtools___pyx_scope_struct__genexpr = {
   &__pyx_tp_as_buffer___pyx_scope_struct__genexpr, /*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_5pysam_9csamtools___pyx_scope_struct__genexpr, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools___pyx_scope_struct__genexpr, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools___pyx_scope_struct__genexpr, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools___pyx_scope_struct__genexpr, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools___pyx_scope_struct__genexpr, /*tp_methods*/
+  __pyx_methods_9csamtools___pyx_scope_struct__genexpr, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -38943,7 +36644,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools___pyx_scope_struct__genexpr = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools___pyx_scope_struct__genexpr, /*tp_new*/
+  __pyx_tp_new_9csamtools___pyx_scope_struct__genexpr, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -38957,11 +36658,11 @@ static PyTypeObject __pyx_type_5pysam_9csamtools___pyx_scope_struct__genexpr = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_9csamtools___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
+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 = __pyx_tp_new_9csamtools___pyx_Generator(t, a, k);
   if (!o) return 0;
-  p = ((struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *)o);
+  p = ((struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)o);
   p->__pyx_v_x = 0;
   p->__pyx_v_y = 0;
   p->__pyx_t_0 = 0;
@@ -38969,18 +36670,19 @@ static PyObject *__pyx_tp_new_5pysam_9csamtools___pyx_scope_struct_1_genexpr(PyT
   return o;
 }
 
-static void __pyx_tp_dealloc_5pysam_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *)o;
-  Py_CLEAR(p->__pyx_v_x);
-  Py_CLEAR(p->__pyx_v_y);
-  Py_CLEAR(p->__pyx_t_0);
-  Py_CLEAR(p->__pyx_t_1);
-  (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_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;
+  Py_XDECREF(p->__pyx_v_x);
+  Py_XDECREF(p->__pyx_v_y);
+  Py_XDECREF(p->__pyx_t_0);
+  Py_XDECREF(p->__pyx_t_1);
+  __pyx_tp_dealloc_9csamtools___pyx_Generator(o);
 }
 
-static int __pyx_tp_traverse_5pysam_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *)o;
+  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;
   }
@@ -38996,9 +36698,10 @@ static int __pyx_tp_traverse_5pysam_9csamtools___pyx_scope_struct_1_genexpr(PyOb
   return 0;
 }
 
-static int __pyx_tp_clear_5pysam_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o) {
-  struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr *)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);
@@ -39014,7 +36717,7 @@ static int __pyx_tp_clear_5pysam_9csamtools___pyx_scope_struct_1_genexpr(PyObjec
   return 0;
 }
 
-static PyMethodDef __pyx_methods_5pysam_9csamtools___pyx_scope_struct_1_genexpr[] = {
+static PyMethodDef __pyx_methods_9csamtools___pyx_scope_struct_1_genexpr[] = {
   {0, 0, 0, 0}
 };
 
@@ -39116,12 +36819,12 @@ static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_genexpr = {
   #endif
 };
 
-static PyTypeObject __pyx_type_5pysam_9csamtools___pyx_scope_struct_1_genexpr = {
+static PyTypeObject __pyx_type_9csamtools___pyx_scope_struct_1_genexpr = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("pysam.csamtools.__pyx_scope_struct_1_genexpr"), /*tp_name*/
-  sizeof(struct __pyx_obj_5pysam_9csamtools___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
+  __Pyx_NAMESTR("csamtools.__pyx_scope_struct_1_genexpr"), /*tp_name*/
+  sizeof(struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_5pysam_9csamtools___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
+  __pyx_tp_dealloc_9csamtools___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -39142,13 +36845,13 @@ static PyTypeObject __pyx_type_5pysam_9csamtools___pyx_scope_struct_1_genexpr =
   &__pyx_tp_as_buffer___pyx_scope_struct_1_genexpr, /*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_5pysam_9csamtools___pyx_scope_struct_1_genexpr, /*tp_traverse*/
-  __pyx_tp_clear_5pysam_9csamtools___pyx_scope_struct_1_genexpr, /*tp_clear*/
+  __pyx_tp_traverse_9csamtools___pyx_scope_struct_1_genexpr, /*tp_traverse*/
+  __pyx_tp_clear_9csamtools___pyx_scope_struct_1_genexpr, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_5pysam_9csamtools___pyx_scope_struct_1_genexpr, /*tp_methods*/
+  __pyx_methods_9csamtools___pyx_scope_struct_1_genexpr, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -39158,7 +36861,7 @@ static PyTypeObject __pyx_type_5pysam_9csamtools___pyx_scope_struct_1_genexpr =
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_5pysam_9csamtools___pyx_scope_struct_1_genexpr, /*tp_new*/
+  __pyx_tp_new_9csamtools___pyx_scope_struct_1_genexpr, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -39257,13 +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_n_s_257, __pyx_k_257, sizeof(__pyx_k_257), 0, 0, 1, 1},
-  {&__pyx_kp_s_258, __pyx_k_258, sizeof(__pyx_k_258), 0, 0, 1, 0},
-  {&__pyx_kp_s_267, __pyx_k_267, sizeof(__pyx_k_267), 0, 0, 1, 0},
-  {&__pyx_kp_s_274, __pyx_k_274, sizeof(__pyx_k_274), 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_291, __pyx_k_291, sizeof(__pyx_k_291), 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},
@@ -39392,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},
@@ -39405,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},
@@ -39416,6 +37115,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__compile, __pyx_k__compile, sizeof(__pyx_k__compile), 0, 0, 1, 1},
   {&__pyx_n_s__consensus_quality, __pyx_k__consensus_quality, sizeof(__pyx_k__consensus_quality), 0, 0, 1, 1},
   {&__pyx_n_s__coverage, __pyx_k__coverage, sizeof(__pyx_k__coverage), 0, 0, 1, 1},
+  {&__pyx_n_s__csamtools, __pyx_k__csamtools, sizeof(__pyx_k__csamtools), 0, 0, 1, 1},
   {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1},
   {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
   {&__pyx_n_s__data_len, __pyx_k__data_len, sizeof(__pyx_k__data_len), 0, 0, 1, 1},
@@ -39448,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},
@@ -39482,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},
@@ -39521,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},
@@ -39539,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},
@@ -39601,9 +37291,9 @@ static int __Pyx_InitCachedBuiltins(void) {
 
 static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
 
-  /* "pysam/csamtools.pyx":64
+  /* "csamtools.pyx":64
  *         return s
  *     elif PyUnicode_Check(s):
  *         return s.encode('ascii')             # <<<<<<<<<<<<<<
@@ -39611,13 +37301,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
-  /* "pysam/csamtools.pyx":84
+  /* "csamtools.pyx":84
  *         return s
  *     elif PyBytes_Check(s):
  *         return s.decode('ascii')             # <<<<<<<<<<<<<<
@@ -39625,13 +37315,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
-  /* "pysam/csamtools.pyx":398
+  /* "csamtools.pyx":398
  *     def __len__(self):
  *         if self.fastafile == NULL:
  *             raise ValueError( "calling len() on closed file" )             # <<<<<<<<<<<<<<
@@ -39639,13 +37329,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
 
-  /* "pysam/csamtools.pyx":431
+  /* "csamtools.pyx":431
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39653,13 +37343,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
 
-  /* "pysam/csamtools.pyx":456
+  /* "csamtools.pyx":456
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39667,13 +37357,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
 
-  /* "pysam/csamtools.pyx":462
+  /* "csamtools.pyx":462
  * 
  *         if not region:
  *             if reference is None: raise ValueError( 'no sequence/region supplied.' )             # <<<<<<<<<<<<<<
@@ -39681,13 +37371,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
 
-  /* "pysam/csamtools.pyx":481
+  /* "csamtools.pyx":481
  *             region = "%s:%i-%i" % (reference, start+1, end)
  *             if PY_MAJOR_VERSION >= 3:
  *                 region = region.encode('ascii')             # <<<<<<<<<<<<<<
@@ -39695,13 +37385,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
 
-  /* "pysam/csamtools.pyx":663
+  /* "csamtools.pyx":663
  *         if self._filename != NULL: free(self._filename )
  *         filename = _my_encodeFilename(filename)
  *         cdef bytes bmode = mode.encode('ascii')             # <<<<<<<<<<<<<<
@@ -39709,13 +37399,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
 
-  /* "pysam/csamtools.pyx":790
+  /* "csamtools.pyx":790
  *         returns -1 if reference is not known.
  *         '''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39723,13 +37413,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
 
-  /* "pysam/csamtools.pyx":797
+  /* "csamtools.pyx":797
  *         '''
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39737,13 +37427,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
 
-  /* "pysam/csamtools.pyx":805
+  /* "csamtools.pyx":805
  *         '''
  *         convert numerical :term:`tid` into :term:`reference` name.'''
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39751,13 +37441,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
 
-  /* "pysam/csamtools.pyx":855
+  /* "csamtools.pyx":855
  *             if len(parts) >= 3: rend = int(parts[2])
  * 
  *         if not reference: return 0, 0, 0, 0             # <<<<<<<<<<<<<<
@@ -39765,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);
@@ -39780,7 +37470,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
 
-  /* "pysam/csamtools.pyx":875
+  /* "csamtools.pyx":875
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39788,13 +37478,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
 
-  /* "pysam/csamtools.pyx":877
+  /* "csamtools.pyx":877
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")             # <<<<<<<<<<<<<<
@@ -39802,13 +37492,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
 
-  /* "pysam/csamtools.pyx":879
+  /* "csamtools.pyx":879
  *             raise NotImplementedError("seek only available in bam files")
  *         if self.isstream:
  *             raise OSError("seek no available in streams")             # <<<<<<<<<<<<<<
@@ -39816,13 +37506,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
 
-  /* "pysam/csamtools.pyx":888
+  /* "csamtools.pyx":888
  *         '''
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39830,13 +37520,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
 
-  /* "pysam/csamtools.pyx":890
+  /* "csamtools.pyx":890
  *             raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam:
  *             raise NotImplementedError("seek only available in bam files")             # <<<<<<<<<<<<<<
@@ -39844,13 +37534,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
 
-  /* "pysam/csamtools.pyx":925
+  /* "csamtools.pyx":925
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39858,13 +37548,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
 
-  /* "pysam/csamtools.pyx":934
+  /* "csamtools.pyx":934
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )             # <<<<<<<<<<<<<<
@@ -39872,13 +37562,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
 
-  /* "pysam/csamtools.pyx":937
+  /* "csamtools.pyx":937
  * 
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )             # <<<<<<<<<<<<<<
@@ -39886,13 +37576,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
 
-  /* "pysam/csamtools.pyx":938
+  /* "csamtools.pyx":938
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
  *                 if not self._hasIndex(): raise ValueError( "no index available for fetch" )             # <<<<<<<<<<<<<<
@@ -39900,13 +37590,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
 
-  /* "pysam/csamtools.pyx":957
+  /* "csamtools.pyx":957
  *         else:
  *             if has_coord:
  *                 raise ValueError ("fetching by region is not available for sam files" )             # <<<<<<<<<<<<<<
@@ -39914,13 +37604,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
 
-  /* "pysam/csamtools.pyx":960
+  /* "csamtools.pyx":960
  * 
  *             if callback:
  *                 raise NotImplementedError( "callback not implemented yet" )             # <<<<<<<<<<<<<<
@@ -39928,13 +37618,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
 
-  /* "pysam/csamtools.pyx":963
+  /* "csamtools.pyx":963
  * 
  *             if self.samfile.header == NULL:
  *                 raise ValueError( "fetch called for samfile without header")             # <<<<<<<<<<<<<<
@@ -39942,13 +37632,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
 
-  /* "pysam/csamtools.pyx":968
+  /* "csamtools.pyx":968
  *             # give warning, sam_read1 segfaults
  *             if self.samfile.header.n_targets == 0:
  *                 warnings.warn( "fetch called for samfile without header")             # <<<<<<<<<<<<<<
@@ -39956,13 +37646,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
 
-  /* "pysam/csamtools.pyx":1009
+  /* "csamtools.pyx":1009
  * 
  *         if mate_data.mate == NULL:
  *             raise ValueError( "mate not found" )             # <<<<<<<<<<<<<<
@@ -39970,13 +37660,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
 
-  /* "pysam/csamtools.pyx":1034
+  /* "csamtools.pyx":1034
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -39984,13 +37674,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74));
 
-  /* "pysam/csamtools.pyx":1043
+  /* "csamtools.pyx":1043
  *         if self.isbam:
  *             if not until_eof and not self._hasIndex() and not self.isremote:
  *                 raise ValueError( "fetch called on bamfile without index" )             # <<<<<<<<<<<<<<
@@ -39998,13 +37688,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
 
-  /* "pysam/csamtools.pyx":1046
+  /* "csamtools.pyx":1046
  * 
  *             if not region:
  *                 raise ValueError( "counting functionality requires a region/reference" )             # <<<<<<<<<<<<<<
@@ -40012,13 +37702,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
 
-  /* "pysam/csamtools.pyx":1047
+  /* "csamtools.pyx":1047
  *             if not region:
  *                 raise ValueError( "counting functionality requires a region/reference" )
  *             if not self._hasIndex(): raise ValueError( "no index available for fetch" )             # <<<<<<<<<<<<<<
@@ -40026,13 +37716,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
 
-  /* "pysam/csamtools.pyx":1057
+  /* "csamtools.pyx":1057
  *             return counter
  *         else:
  *             raise ValueError ("count for a region is not available for sam files" )             # <<<<<<<<<<<<<<
@@ -40040,13 +37730,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));
 
-  /* "pysam/csamtools.pyx":1116
+  /* "csamtools.pyx":1116
  * 
  *         if not self._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40054,13 +37744,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));
 
-  /* "pysam/csamtools.pyx":1121
+  /* "csamtools.pyx":1121
  * 
  *         if self.isbam:
  *             if not self._hasIndex(): raise ValueError( "no index available for pileup" )             # <<<<<<<<<<<<<<
@@ -40068,13 +37758,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
 
-  /* "pysam/csamtools.pyx":1124
+  /* "csamtools.pyx":1124
  * 
  *             if callback:
  *                 if not has_coord: raise ValueError( "callback functionality requires a region/reference" )             # <<<<<<<<<<<<<<
@@ -40082,13 +37772,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84));
 
-  /* "pysam/csamtools.pyx":1145
+  /* "csamtools.pyx":1145
  * 
  *         else:
  *             raise NotImplementedError( "pileup of samfiles not implemented yet" )             # <<<<<<<<<<<<<<
@@ -40096,13 +37786,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));
 
-  /* "pysam/csamtools.pyx":1189
+  /* "csamtools.pyx":1189
  *         '''number of :term:`filename` associated with this object.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40110,13 +37800,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
 
-  /* "pysam/csamtools.pyx":1195
+  /* "csamtools.pyx":1195
  *         '''number of :term:`reference` sequences in the file.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40124,13 +37814,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));
 
-  /* "pysam/csamtools.pyx":1201
+  /* "csamtools.pyx":1201
  *         """tuple with the names of :term:`reference` sequences."""
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40138,13 +37828,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89));
 
-  /* "pysam/csamtools.pyx":1212
+  /* "csamtools.pyx":1212
  *         """
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40152,13 +37842,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));
 
-  /* "pysam/csamtools.pyx":1222
+  /* "csamtools.pyx":1222
  *         """
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40166,13 +37856,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_91));
 
-  /* "pysam/csamtools.pyx":1223
+  /* "csamtools.pyx":1223
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )             # <<<<<<<<<<<<<<
@@ -40180,13 +37870,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_93));
 
-  /* "pysam/csamtools.pyx":1235
+  /* "csamtools.pyx":1235
  *         """
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40194,13 +37884,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));
 
-  /* "pysam/csamtools.pyx":1236
+  /* "csamtools.pyx":1236
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *             if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )             # <<<<<<<<<<<<<<
@@ -40208,13 +37898,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));
 
-  /* "pysam/csamtools.pyx":1248
+  /* "csamtools.pyx":1248
  *         '''full contents of the :term:`sam file` header as a string.'''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40222,13 +37912,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));
 
-  /* "pysam/csamtools.pyx":1256
+  /* "csamtools.pyx":1256
  *         '''
  *         def __get__(self):
  *             if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40236,13 +37926,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98));
 
-  /* "pysam/csamtools.pyx":1263
+  /* "csamtools.pyx":1263
  *                 # convert to python string (note: call self.text to create 0-terminated string)
  *                 t = self.text
  *                 for line in t.split("\n"):             # <<<<<<<<<<<<<<
@@ -40250,13 +37940,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));
 
-  /* "pysam/csamtools.pyx":1265
+  /* "csamtools.pyx":1265
  *                 for line in t.split("\n"):
  *                     if not line.strip(): continue
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line             # <<<<<<<<<<<<<<
@@ -40264,13 +37954,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_101));
 
-  /* "pysam/csamtools.pyx":1266
+  /* "csamtools.pyx":1266
  *                     if not line.strip(): continue
  *                     assert line.startswith("@"), "header line without '@': '%s'" % line
  *                     fields = line[1:].split("\t")             # <<<<<<<<<<<<<<
@@ -40278,13 +37968,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103));
 
-  /* "pysam/csamtools.pyx":1279
+  /* "csamtools.pyx":1279
  *                     x = {}
  *                     for field in fields[1:]:
  *                         key, value = field.split(":",1)             # <<<<<<<<<<<<<<
@@ -40292,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));
@@ -40301,7 +37991,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106));
 
-  /* "pysam/csamtools.pyx":1377
+  /* "csamtools.pyx":1377
  *         dest.text = <char*>calloc( len(text), sizeof(char))
  *         dest.l_text = len(text)
  *         cdef bytes btext = text.encode('ascii')             # <<<<<<<<<<<<<<
@@ -40309,13 +37999,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_112));
 
-  /* "pysam/csamtools.pyx":1397
+  /* "csamtools.pyx":1397
  *                 seqname, seqlen = seqs[x]
  *                 dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
  *                 bseqname = seqname.encode('ascii')             # <<<<<<<<<<<<<<
@@ -40323,13 +38013,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_114));
 
-  /* "pysam/csamtools.pyx":1412
+  /* "csamtools.pyx":1412
  *     ###############################################################
  *     def __iter__(self):
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40337,13 +38027,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_115));
 
-  /* "pysam/csamtools.pyx":1414
+  /* "csamtools.pyx":1414
  *         if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
  *         if not self.isbam and self.samfile.header.n_targets == 0:
  *                 raise NotImplementedError( "can not iterate over samfile without header")             # <<<<<<<<<<<<<<
@@ -40351,13 +38041,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));
 
-  /* "pysam/csamtools.pyx":1484
+  /* "csamtools.pyx":1484
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40365,13 +38055,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118));
 
-  /* "pysam/csamtools.pyx":1487
+  /* "csamtools.pyx":1487
  * 
  *         if not samfile._hasIndex():
  *             raise ValueError( "no index available for iteration" )             # <<<<<<<<<<<<<<
@@ -40379,13 +38069,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120));
 
-  /* "pysam/csamtools.pyx":1553
+  /* "csamtools.pyx":1553
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40393,13 +38083,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_121));
 
-  /* "pysam/csamtools.pyx":1604
+  /* "csamtools.pyx":1604
  *     def __cinit__(self, Samfile samfile):
  *         assert samfile._isOpen()
  *         if not samfile._hasIndex(): raise ValueError("no index available for fetch")             # <<<<<<<<<<<<<<
@@ -40407,13 +38097,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));
 
-  /* "pysam/csamtools.pyx":1650
+  /* "csamtools.pyx":1650
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40421,13 +38111,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));
 
-  /* "pysam/csamtools.pyx":1653
+  /* "csamtools.pyx":1653
  * 
  *         if not samfile._isOpen():
  *             raise ValueError( "I/O operation on closed file" )             # <<<<<<<<<<<<<<
@@ -40435,13 +38125,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124));
 
-  /* "pysam/csamtools.pyx":1954
+  /* "csamtools.pyx":1954
  *             self.cnext()
  *             if self.n_plp < 0:
  *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
@@ -40449,13 +38139,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_130));
 
-  /* "pysam/csamtools.pyx":1990
+  /* "csamtools.pyx":1990
  * 
  *             if self.n_plp < 0:
  *                 raise ValueError("error during iteration" )             # <<<<<<<<<<<<<<
@@ -40463,13 +38153,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_131));
 
-  /* "pysam/csamtools.pyx":2153
+  /* "csamtools.pyx":2153
  *             qual = self.qual
  *         else:
  *             seq = self.seq.decode('ascii')             # <<<<<<<<<<<<<<
@@ -40477,13 +38167,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_133));
 
-  /* "pysam/csamtools.pyx":2154
+  /* "csamtools.pyx":2154
  *         else:
  *             seq = self.seq.decode('ascii')
  *             qual = self.qual.decode('ascii')             # <<<<<<<<<<<<<<
@@ -40491,13 +38181,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));
 
-  /* "pysam/csamtools.pyx":2563
+  /* "csamtools.pyx":2563
  *                 for pytag, value in tags:
  *                     if not type(pytag) is bytes:
  *                         pytag = pytag.encode('ascii')             # <<<<<<<<<<<<<<
@@ -40505,13 +38195,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_139));
 
-  /* "pysam/csamtools.pyx":2591
+  /* "csamtools.pyx":2591
  *                         datafmt = "2sccI%i%s" % (len(value), datafmt)
  *                         args.extend( [pytag[:2],
  *                                       pytype.encode('ascii'),             # <<<<<<<<<<<<<<
@@ -40519,13 +38209,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142));
 
-  /* "pysam/csamtools.pyx":2592
+  /* "csamtools.pyx":2592
  *                         args.extend( [pytag[:2],
  *                                       pytype.encode('ascii'),
  *                                       datatype.encode('ascii'),             # <<<<<<<<<<<<<<
@@ -40533,13 +38223,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_143));
 
-  /* "pysam/csamtools.pyx":2615
+  /* "csamtools.pyx":2615
  *                         # Note: hex strings (H) are not supported yet
  *                         if t is not bytes:
  *                             value = value.encode('ascii')             # <<<<<<<<<<<<<<
@@ -40547,13 +38237,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144));
 
-  /* "pysam/csamtools.pyx":2622
+  /* "csamtools.pyx":2622
  * 
  *                     args.extend( [pytag[:2],
  *                                   pytype.encode('ascii'),             # <<<<<<<<<<<<<<
@@ -40561,13 +38251,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_146));
 
-  /* "pysam/csamtools.pyx":3020
+  /* "csamtools.pyx":3020
  *     '''
  *     def __init__(self):
  *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
@@ -40575,13 +38265,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_172));
 
-  /* "pysam/csamtools.pyx":3046
+  /* "csamtools.pyx":3046
  * 
  *             if self.plp[0] == NULL:
  *                 raise ValueError("PileupProxy accessed after iterator finished")             # <<<<<<<<<<<<<<
@@ -40589,13 +38279,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174));
 
-  /* "pysam/csamtools.pyx":3059
+  /* "csamtools.pyx":3059
  * 
  *     def __init__(self):
  *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
@@ -40603,13 +38293,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_175));
 
-  /* "pysam/csamtools.pyx":3172
+  /* "csamtools.pyx":3172
  *         # recover. Thus redirect output to file with -o option.
  *         if method == "view":
  *             if "-o" in args: raise ValueError("option -o is forbidden in samtools view")             # <<<<<<<<<<<<<<
@@ -40617,13 +38307,13 @@ 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));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_180));
 
-  /* "pysam/csamtools.pyx":3197
+  /* "csamtools.pyx":3197
  *         stdout_save.restore()
  *         try:
  *             with open( stdout_f, "r") as inf:             # <<<<<<<<<<<<<<
@@ -40631,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);
@@ -40643,7 +38333,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181));
 
-  /* "pysam/csamtools.pyx":3200
+  /* "csamtools.pyx":3200
  *                 out_stdout = inf.readlines()
  *         except UnicodeDecodeError:
  *             with open( stdout_f, "rb") as inf:             # <<<<<<<<<<<<<<
@@ -40651,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);
@@ -40663,7 +38353,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_182));
 
-  /* "pysam/csamtools.pyx":3210
+  /* "csamtools.pyx":3210
  *     pysam_unset_stderr()
  *     try:
  *         with open( stderr_f, "r") as inf:             # <<<<<<<<<<<<<<
@@ -40671,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);
@@ -40683,7 +38373,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_183));
 
-  /* "pysam/csamtools.pyx":3213
+  /* "csamtools.pyx":3213
  *             out_stderr = inf.readlines()
  *     except UnicodeDecodeError:
  *         with open( stderr_f, "rb") as inf:             # <<<<<<<<<<<<<<
@@ -40691,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);
@@ -40703,7 +38393,7 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_184));
 
-  /* "pysam/csamtools.pyx":143
+  /* "csamtools.pyx":143
  * else:
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
  * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )             # <<<<<<<<<<<<<<
@@ -40711,441 +38401,159 @@ 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));
 
-  /* "pysam/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;}
-
-  /* "pysam/csamtools.pyx":308
- *     stderr is captured.
- *     '''
- *     def __init__(self):             # <<<<<<<<<<<<<<
- *         return
- *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
- */
-  __pyx_k_tuple_259 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_259)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_259);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_259, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_259));
-  __pyx_k_codeobj_260 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_259, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 308, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_260)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/csamtools.pyx":314
- *         self.stderr_save.setfd( self.stderr_h )
- * 
- *     def readAndRelease( self ):             # <<<<<<<<<<<<<<
- *         return []
- *         self.stderr_save.restore()
- */
-  __pyx_k_tuple_261 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_261)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_261);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_261, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_261));
-  __pyx_k_codeobj_262 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_261, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__readAndRelease, 314, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_262)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/csamtools.pyx":323
- *         return lines
- * 
- *     def release(self):             # <<<<<<<<<<<<<<
- *         return
- *         self.stderr_save.restore()
- */
-  __pyx_k_tuple_263 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_263)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_263);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_263, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_263));
-  __pyx_k_codeobj_264 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_263, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__release, 323, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_264)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/csamtools.pyx":329
- *             os.remove( self.stderr_f )
- * 
- *     def __del__(self):             # <<<<<<<<<<<<<<
- *         self.release()
- * 
- */
-  __pyx_k_tuple_265 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_265)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_265);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_265, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_265));
-  __pyx_k_codeobj_266 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_265, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____del__, 329, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_266)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/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_268 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_268)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_268);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_268, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_268));
-  __pyx_k_codeobj_269 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_268, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 334, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_269)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/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_270 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_270)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_270);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_270, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_270));
-  __pyx_k_codeobj_271 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_270, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__readAndRelease, 335, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_271)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/csamtools.pyx":336
- *     def __init__(self): pass
- *     def readAndRelease(self): return []
- *     def release(self): pass             # <<<<<<<<<<<<<<
- * 
- * if platform.system()=='Windows':
- */
-  __pyx_k_tuple_272 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_272)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_272);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_272, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_272));
-  __pyx_k_codeobj_273 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_272, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__release, 336, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_273)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/csamtools.pyx":354
+  /* "csamtools.pyx":354
  * 
  * # order of records within sam headers
  * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" )             # <<<<<<<<<<<<<<
  * 
  * # type conversions within sam header records
  */
-  __pyx_k_tuple_275 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_275)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_275);
+  __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_275, 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_275, 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_275, 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_275, 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_275, 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_275));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_257));
 
-  /* "pysam/csamtools.pyx":364
+  /* "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", "PG" ),
  */
-  __pyx_k_tuple_276 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_276)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_276);
+  __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_276, 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_276, 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_276, 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_276));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_258));
 
-  /* "pysam/csamtools.pyx":365
+  /* "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" ),
  *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
  */
-  __pyx_k_tuple_277 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_277)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_277);
+  __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_277, 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_277, 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_277, 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_277, 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_277, 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_277, 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_277));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_259));
 
-  /* "pysam/csamtools.pyx":366
+  /* "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" ),             # <<<<<<<<<<<<<<
  *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
  * 
  */
-  __pyx_k_tuple_278 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_278)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_278);
+  __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_278, 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_278, 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_278, 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_278, 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_278, 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_278, 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_278, 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_278, 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_278, 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_278, 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_278, 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_INCREF(((PyObject *)__pyx_n_s__PG));
-  PyTuple_SET_ITEM(__pyx_k_tuple_278, 11, ((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_278));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_260));
 
-  /* "pysam/csamtools.pyx":367
+  /* "csamtools.pyx":367
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
  *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
  *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  __pyx_k_tuple_279 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_279)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_279);
+  __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_279, 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_279, 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_279, 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_279, 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_INCREF(((PyObject *)__pyx_n_s__PP));
-  PyTuple_SET_ITEM(__pyx_k_tuple_279, 4, ((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_279));
-
-  /* "pysam/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_280 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_280)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_280);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_280, 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_280, 1, ((PyObject *)__pyx_n_s__id));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_280));
-  __pyx_k_codeobj_281 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_280, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 3092, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_281)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_k_tuple_282 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_282)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_282);
-  __Pyx_INCREF(((PyObject *)__pyx_int_1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_282, 0, ((PyObject *)__pyx_int_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_int_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_282));
-
-  /* "pysam/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_283 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_283)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_283);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_283, 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_283, 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_283, 2, ((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_283));
-  __pyx_k_codeobj_284 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setdevice, 3096, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_284)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/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_285 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_285)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_285);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_285, 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_285, 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_285, 2, ((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_285));
-  __pyx_k_codeobj_286 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_285, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setfile, 3101, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_286)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/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_287 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_287)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_287);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_287, 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_287, 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_287, 2, ((PyObject *)__pyx_n_s__ofd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ofd));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_287));
-  __pyx_k_codeobj_288 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_287, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setfd, 3106, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_288)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/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_289 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_289)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_289);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_289, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_289));
-  __pyx_k_codeobj_290 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__restore, 3114, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_290)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/csamtools.pyx":3125
- *             del self.streams[-1]
- * 
- * def _samtools_dispatch( method,             # <<<<<<<<<<<<<<
- *                         args = (),
- *                         catch_stdout = True ):
- */
-  __pyx_k_tuple_292 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_292)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_292);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__method));
-  PyTuple_SET_ITEM(__pyx_k_tuple_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 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_292, 15, ((PyObject *)__pyx_n_s__a));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_292));
-  __pyx_k_codeobj_293 = (PyObject*)__Pyx_PyCode_New(3, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_292, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s___samtools_dispatch, 3125, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_293)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_261));
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -41204,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 ---*/
@@ -41226,27 +38628,20 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   #endif
   /*--- Module creation code ---*/
   #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("csamtools"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("csamtools"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
   #else
   __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, "pysam.csamtools")) {
-      if (unlikely(PyDict_SetItemString(modules, "pysam.csamtools", __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);
+  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  #if PY_MAJOR_VERSION < 3
+  Py_INCREF(__pyx_m);
   #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
+  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_module_is_main_pysam__csamtools) {
+  if (__pyx_module_is_main_csamtools) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
   /*--- Builtin init code ---*/
@@ -41254,195 +38649,176 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   /*--- Constants init code ---*/
   if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Global init code ---*/
-  __pyx_v_5pysam_9csamtools__FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  __pyx_v_9csamtools__FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  __pyx_vtabptr_5pysam_9csamtools_Fastafile = &__pyx_vtable_5pysam_9csamtools_Fastafile;
-  __pyx_vtable_5pysam_9csamtools_Fastafile._fetch = (char *(*)(struct __pyx_obj_5pysam_9csamtools_Fastafile *, char *, int, int, int *))__pyx_f_5pysam_9csamtools_9Fastafile__fetch;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_5pysam_9csamtools_Fastafile.tp_dict, __pyx_vtabptr_5pysam_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Fastafile", (PyObject *)&__pyx_type_5pysam_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_Fastafile = &__pyx_type_5pysam_9csamtools_Fastafile;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
+  __pyx_vtabptr_9csamtools_Fastafile = &__pyx_vtable_9csamtools_Fastafile;
+  __pyx_vtable_9csamtools_Fastafile._fetch = (char *(*)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *))__pyx_f_9csamtools_9Fastafile__fetch;
+  if (PyType_Ready(&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_Fastafile.tp_dict, __pyx_vtabptr_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "Fastafile", (PyObject *)&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_Fastafile = &__pyx_type_9csamtools_Fastafile;
+  if (PyType_Ready(&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_9csamtools_AlignedRead, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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_5pysam_9csamtools_11AlignedRead_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_5pysam_9csamtools_11AlignedRead_4__str__.doc = __pyx_doc_5pysam_9csamtools_11AlignedRead_4__str__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_9csamtools_11AlignedRead_4__str__;
-    }
-  }
-  #endif
-  if (__Pyx_SetAttrString(__pyx_m, "AlignedRead", (PyObject *)&__pyx_type_5pysam_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_AlignedRead = &__pyx_type_5pysam_9csamtools_AlignedRead;
-  __pyx_vtabptr_5pysam_9csamtools_Samfile = &__pyx_vtable_5pysam_9csamtools_Samfile;
-  __pyx_vtable_5pysam_9csamtools_Samfile._buildHeader = (bam_header_t *(*)(struct __pyx_obj_5pysam_9csamtools_Samfile *, PyObject *))__pyx_f_5pysam_9csamtools_7Samfile__buildHeader;
-  __pyx_vtable_5pysam_9csamtools_Samfile.getCurrent = (bam1_t *(*)(struct __pyx_obj_5pysam_9csamtools_Samfile *))__pyx_f_5pysam_9csamtools_7Samfile_getCurrent;
-  __pyx_vtable_5pysam_9csamtools_Samfile.cnext = (int (*)(struct __pyx_obj_5pysam_9csamtools_Samfile *))__pyx_f_5pysam_9csamtools_7Samfile_cnext;
-  __pyx_vtable_5pysam_9csamtools_Samfile.write = (int (*)(struct __pyx_obj_5pysam_9csamtools_Samfile *, struct __pyx_obj_5pysam_9csamtools_AlignedRead *, int __pyx_skip_dispatch))__pyx_f_5pysam_9csamtools_7Samfile_write;
-  __pyx_vtable_5pysam_9csamtools_Samfile._getrname = (char *(*)(struct __pyx_obj_5pysam_9csamtools_Samfile *, int))__pyx_f_5pysam_9csamtools_7Samfile__getrname;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
+      __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;}
+  __pyx_ptype_9csamtools_AlignedRead = &__pyx_type_9csamtools_AlignedRead;
+  __pyx_vtabptr_9csamtools_Samfile = &__pyx_vtable_9csamtools_Samfile;
+  __pyx_vtable_9csamtools_Samfile._buildHeader = (bam_header_t *(*)(struct __pyx_obj_9csamtools_Samfile *, PyObject *))__pyx_f_9csamtools_7Samfile__buildHeader;
+  __pyx_vtable_9csamtools_Samfile.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_getCurrent;
+  __pyx_vtable_9csamtools_Samfile.cnext = (int (*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_cnext;
+  __pyx_vtable_9csamtools_Samfile.write = (int (*)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch))__pyx_f_9csamtools_7Samfile_write;
+  __pyx_vtable_9csamtools_Samfile._getrname = (char *(*)(struct __pyx_obj_9csamtools_Samfile *, int))__pyx_f_9csamtools_7Samfile__getrname;
+  if (PyType_Ready(&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_9csamtools_Samfile, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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_5pysam_9csamtools_7Samfile_42__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_5pysam_9csamtools_7Samfile_42__next__.doc = __pyx_doc_5pysam_9csamtools_7Samfile_42__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_9csamtools_7Samfile_42__next__;
-    }
-  }
-  #endif
-  if (__Pyx_SetVtable(__pyx_type_5pysam_9csamtools_Samfile.tp_dict, __pyx_vtabptr_5pysam_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Samfile", (PyObject *)&__pyx_type_5pysam_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_Samfile = &__pyx_type_5pysam_9csamtools_Samfile;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "PileupProxy", (PyObject *)&__pyx_type_5pysam_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_PileupProxy = &__pyx_type_5pysam_9csamtools_PileupProxy;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "PileupRead", (PyObject *)&__pyx_type_5pysam_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_PileupRead = &__pyx_type_5pysam_9csamtools_PileupRead;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRow", (PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IteratorRow = &__pyx_type_5pysam_9csamtools_IteratorRow;
-  __pyx_vtabptr_5pysam_9csamtools_IteratorRowRegion = &__pyx_vtable_5pysam_9csamtools_IteratorRowRegion;
-  __pyx_vtable_5pysam_9csamtools_IteratorRowRegion.getCurrent = (bam1_t *(*)(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *))__pyx_f_5pysam_9csamtools_17IteratorRowRegion_getCurrent;
-  __pyx_vtable_5pysam_9csamtools_IteratorRowRegion.cnext = (int (*)(struct __pyx_obj_5pysam_9csamtools_IteratorRowRegion *))__pyx_f_5pysam_9csamtools_17IteratorRowRegion_cnext;
-  __pyx_type_5pysam_9csamtools_IteratorRowRegion.tp_base = __pyx_ptype_5pysam_9csamtools_IteratorRow;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
+      __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;}
+  if (__Pyx_SetAttrString(__pyx_m, "Samfile", (PyObject *)&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_Samfile = &__pyx_type_9csamtools_Samfile;
+  if (PyType_Ready(&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "PileupProxy", (PyObject *)&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_PileupProxy = &__pyx_type_9csamtools_PileupProxy;
+  if (PyType_Ready(&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "PileupRead", (PyObject *)&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_PileupRead = &__pyx_type_9csamtools_PileupRead;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRow", (PyObject *)&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRow = &__pyx_type_9csamtools_IteratorRow;
+  __pyx_vtabptr_9csamtools_IteratorRowRegion = &__pyx_vtable_9csamtools_IteratorRowRegion;
+  __pyx_vtable_9csamtools_IteratorRowRegion.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_getCurrent;
+  __pyx_vtable_9csamtools_IteratorRowRegion.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_cnext;
+  __pyx_type_9csamtools_IteratorRowRegion.tp_base = __pyx_ptype_9csamtools_IteratorRow;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRowRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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_5pysam_9csamtools_17IteratorRowRegion_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_5pysam_9csamtools_17IteratorRowRegion_4__next__.doc = __pyx_doc_5pysam_9csamtools_17IteratorRowRegion_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_9csamtools_17IteratorRowRegion_4__next__;
-    }
-  }
-  #endif
-  if (__Pyx_SetVtable(__pyx_type_5pysam_9csamtools_IteratorRowRegion.tp_dict, __pyx_vtabptr_5pysam_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowRegion", (PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IteratorRowRegion = &__pyx_type_5pysam_9csamtools_IteratorRowRegion;
-  __pyx_vtabptr_5pysam_9csamtools_IteratorRowAll = &__pyx_vtable_5pysam_9csamtools_IteratorRowAll;
-  __pyx_vtable_5pysam_9csamtools_IteratorRowAll.getCurrent = (bam1_t *(*)(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *))__pyx_f_5pysam_9csamtools_14IteratorRowAll_getCurrent;
-  __pyx_vtable_5pysam_9csamtools_IteratorRowAll.cnext = (int (*)(struct __pyx_obj_5pysam_9csamtools_IteratorRowAll *))__pyx_f_5pysam_9csamtools_14IteratorRowAll_cnext;
-  __pyx_type_5pysam_9csamtools_IteratorRowAll.tp_base = __pyx_ptype_5pysam_9csamtools_IteratorRow;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
+      __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;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowRegion", (PyObject *)&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRowRegion = &__pyx_type_9csamtools_IteratorRowRegion;
+  __pyx_vtabptr_9csamtools_IteratorRowAll = &__pyx_vtable_9csamtools_IteratorRowAll;
+  __pyx_vtable_9csamtools_IteratorRowAll.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_getCurrent;
+  __pyx_vtable_9csamtools_IteratorRowAll.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_cnext;
+  __pyx_type_9csamtools_IteratorRowAll.tp_base = __pyx_ptype_9csamtools_IteratorRow;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRowAll, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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_5pysam_9csamtools_14IteratorRowAll_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_5pysam_9csamtools_14IteratorRowAll_4__next__.doc = __pyx_doc_5pysam_9csamtools_14IteratorRowAll_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_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__;
     }
   }
-  #endif
-  if (__Pyx_SetVtable(__pyx_type_5pysam_9csamtools_IteratorRowAll.tp_dict, __pyx_vtabptr_5pysam_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAll", (PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IteratorRowAll = &__pyx_type_5pysam_9csamtools_IteratorRowAll;
-  __pyx_type_5pysam_9csamtools_IteratorRowAllRefs.tp_base = __pyx_ptype_5pysam_9csamtools_IteratorRow;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
+  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;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAll", (PyObject *)&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRowAll = &__pyx_type_9csamtools_IteratorRowAll;
+  __pyx_type_9csamtools_IteratorRowAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorRow;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRowAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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_5pysam_9csamtools_18IteratorRowAllRefs_6__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_5pysam_9csamtools_18IteratorRowAllRefs_6__next__.doc = __pyx_doc_5pysam_9csamtools_18IteratorRowAllRefs_6__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_9csamtools_18IteratorRowAllRefs_6__next__;
-    }
-  }
-  #endif
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAllRefs", (PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IteratorRowAllRefs = &__pyx_type_5pysam_9csamtools_IteratorRowAllRefs;
-  __pyx_vtabptr_5pysam_9csamtools_IteratorRowSelection = &__pyx_vtable_5pysam_9csamtools_IteratorRowSelection;
-  __pyx_vtable_5pysam_9csamtools_IteratorRowSelection.getCurrent = (bam1_t *(*)(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *))__pyx_f_5pysam_9csamtools_20IteratorRowSelection_getCurrent;
-  __pyx_vtable_5pysam_9csamtools_IteratorRowSelection.cnext = (int (*)(struct __pyx_obj_5pysam_9csamtools_IteratorRowSelection *))__pyx_f_5pysam_9csamtools_20IteratorRowSelection_cnext;
-  __pyx_type_5pysam_9csamtools_IteratorRowSelection.tp_base = __pyx_ptype_5pysam_9csamtools_IteratorRow;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
+      __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;}
+  __pyx_ptype_9csamtools_IteratorRowAllRefs = &__pyx_type_9csamtools_IteratorRowAllRefs;
+  __pyx_vtabptr_9csamtools_IteratorRowSelection = &__pyx_vtable_9csamtools_IteratorRowSelection;
+  __pyx_vtable_9csamtools_IteratorRowSelection.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_getCurrent;
+  __pyx_vtable_9csamtools_IteratorRowSelection.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_cnext;
+  __pyx_type_9csamtools_IteratorRowSelection.tp_base = __pyx_ptype_9csamtools_IteratorRow;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRowSelection, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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_5pysam_9csamtools_20IteratorRowSelection_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_5pysam_9csamtools_20IteratorRowSelection_4__next__.doc = __pyx_doc_5pysam_9csamtools_20IteratorRowSelection_4__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_9csamtools_20IteratorRowSelection_4__next__;
-    }
-  }
-  #endif
-  if (__Pyx_SetVtable(__pyx_type_5pysam_9csamtools_IteratorRowSelection.tp_dict, __pyx_vtabptr_5pysam_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowSelection", (PyObject *)&__pyx_type_5pysam_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IteratorRowSelection = &__pyx_type_5pysam_9csamtools_IteratorRowSelection;
-  __pyx_vtabptr_5pysam_9csamtools_IteratorColumn = &__pyx_vtable_5pysam_9csamtools_IteratorColumn;
-  __pyx_vtable_5pysam_9csamtools_IteratorColumn.cnext = (int (*)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *))__pyx_f_5pysam_9csamtools_14IteratorColumn_cnext;
-  __pyx_vtable_5pysam_9csamtools_IteratorColumn.getSequence = (char *(*)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *))__pyx_f_5pysam_9csamtools_14IteratorColumn_getSequence;
-  __pyx_vtable_5pysam_9csamtools_IteratorColumn.setMask = (PyObject *(*)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *, PyObject *))__pyx_f_5pysam_9csamtools_14IteratorColumn_setMask;
-  __pyx_vtable_5pysam_9csamtools_IteratorColumn.setupIteratorData = (PyObject *(*)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_5pysam_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args))__pyx_f_5pysam_9csamtools_14IteratorColumn_setupIteratorData;
-  __pyx_vtable_5pysam_9csamtools_IteratorColumn.reset = (PyObject *(*)(struct __pyx_obj_5pysam_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *))__pyx_f_5pysam_9csamtools_14IteratorColumn_reset;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type_5pysam_9csamtools_IteratorColumn.tp_dict, __pyx_vtabptr_5pysam_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumn", (PyObject *)&__pyx_type_5pysam_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IteratorColumn = &__pyx_type_5pysam_9csamtools_IteratorColumn;
-  __pyx_vtabptr_5pysam_9csamtools_IteratorColumnRegion = &__pyx_vtable_5pysam_9csamtools_IteratorColumnRegion;
-  __pyx_vtable_5pysam_9csamtools_IteratorColumnRegion.__pyx_base = *__pyx_vtabptr_5pysam_9csamtools_IteratorColumn;
-  __pyx_type_5pysam_9csamtools_IteratorColumnRegion.tp_base = __pyx_ptype_5pysam_9csamtools_IteratorColumn;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
+      __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;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorRowSelection", (PyObject *)&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorRowSelection = &__pyx_type_9csamtools_IteratorRowSelection;
+  __pyx_vtabptr_9csamtools_IteratorColumn = &__pyx_vtable_9csamtools_IteratorColumn;
+  __pyx_vtable_9csamtools_IteratorColumn.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_cnext;
+  __pyx_vtable_9csamtools_IteratorColumn.getSequence = (char *(*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_getSequence;
+  __pyx_vtable_9csamtools_IteratorColumn.setMask = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_setMask;
+  __pyx_vtable_9csamtools_IteratorColumn.setupIteratorData = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args))__pyx_f_9csamtools_14IteratorColumn_setupIteratorData;
+  __pyx_vtable_9csamtools_IteratorColumn.reset = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_reset;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumn.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumn", (PyObject *)&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorColumn = &__pyx_type_9csamtools_IteratorColumn;
+  __pyx_vtabptr_9csamtools_IteratorColumnRegion = &__pyx_vtable_9csamtools_IteratorColumnRegion;
+  __pyx_vtable_9csamtools_IteratorColumnRegion.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
+  __pyx_type_9csamtools_IteratorColumnRegion.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_9csamtools_IteratorColumnRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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_5pysam_9csamtools_20IteratorColumnRegion_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_5pysam_9csamtools_20IteratorColumnRegion_2__next__.doc = __pyx_doc_5pysam_9csamtools_20IteratorColumnRegion_2__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_9csamtools_20IteratorColumnRegion_2__next__;
-    }
-  }
-  #endif
-  if (__Pyx_SetVtable(__pyx_type_5pysam_9csamtools_IteratorColumnRegion.tp_dict, __pyx_vtabptr_5pysam_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnRegion", (PyObject *)&__pyx_type_5pysam_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IteratorColumnRegion = &__pyx_type_5pysam_9csamtools_IteratorColumnRegion;
-  __pyx_vtabptr_5pysam_9csamtools_IteratorColumnAllRefs = &__pyx_vtable_5pysam_9csamtools_IteratorColumnAllRefs;
-  __pyx_vtable_5pysam_9csamtools_IteratorColumnAllRefs.__pyx_base = *__pyx_vtabptr_5pysam_9csamtools_IteratorColumn;
-  __pyx_type_5pysam_9csamtools_IteratorColumnAllRefs.tp_base = __pyx_ptype_5pysam_9csamtools_IteratorColumn;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
+      __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;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnRegion", (PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorColumnRegion = &__pyx_type_9csamtools_IteratorColumnRegion;
+  __pyx_vtabptr_9csamtools_IteratorColumnAllRefs = &__pyx_vtable_9csamtools_IteratorColumnAllRefs;
+  __pyx_vtable_9csamtools_IteratorColumnAllRefs.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
+  __pyx_type_9csamtools_IteratorColumnAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
+  if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   {
-    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_9csamtools_IteratorColumnAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    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_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
-      __pyx_wrapperbase_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__.doc = __pyx_doc_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__;
-      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_9csamtools_21IteratorColumnAllRefs_2__next__;
-    }
-  }
-  #endif
-  if (__Pyx_SetVtable(__pyx_type_5pysam_9csamtools_IteratorColumnAllRefs.tp_dict, __pyx_vtabptr_5pysam_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnAllRefs", (PyObject *)&__pyx_type_5pysam_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IteratorColumnAllRefs = &__pyx_type_5pysam_9csamtools_IteratorColumnAllRefs;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "IndexedReads", (PyObject *)&__pyx_type_5pysam_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_IndexedReads = &__pyx_type_5pysam_9csamtools_IndexedReads;
-  if (PyType_Ready(&__pyx_type_5pysam_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_5pysam_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools_SNPCall = &__pyx_type_5pysam_9csamtools_SNPCall;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools___pyx_scope_struct__genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools___pyx_scope_struct__genexpr = &__pyx_type_5pysam_9csamtools___pyx_scope_struct__genexpr;
-  if (PyType_Ready(&__pyx_type_5pysam_9csamtools___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5pysam_9csamtools___pyx_scope_struct_1_genexpr = &__pyx_type_5pysam_9csamtools___pyx_scope_struct_1_genexpr;
+      __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;}
+  if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IteratorColumnAllRefs = &__pyx_type_9csamtools_IteratorColumnAllRefs;
+  if (PyType_Ready(&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "IndexedReads", (PyObject *)&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_9csamtools_IndexedReads = &__pyx_type_9csamtools_IndexedReads;
+  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 ---*/
-  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
-  #if CYTHON_COMPILING_IN_PYPY
-  sizeof(PyTypeObject),
-  #else
-  sizeof(PyHeapTypeObject),
-  #endif
-  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   /*--- Execution code ---*/
 
-  /* "pysam/csamtools.pyx":4
+  /* "csamtools.pyx":4
  * # cython: profile=True
  * # adds doc-strings for sphinx
  * import tempfile             # <<<<<<<<<<<<<<
@@ -41454,7 +38830,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tempfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":5
+  /* "csamtools.pyx":5
  * # adds doc-strings for sphinx
  * import tempfile
  * import os             # <<<<<<<<<<<<<<
@@ -41466,7 +38842,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":6
+  /* "csamtools.pyx":6
  * import tempfile
  * import os
  * import sys             # <<<<<<<<<<<<<<
@@ -41478,7 +38854,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":7
+  /* "csamtools.pyx":7
  * import os
  * import sys
  * import types             # <<<<<<<<<<<<<<
@@ -41490,7 +38866,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":8
+  /* "csamtools.pyx":8
  * import sys
  * import types
  * import itertools             # <<<<<<<<<<<<<<
@@ -41502,7 +38878,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":9
+  /* "csamtools.pyx":9
  * import types
  * import itertools
  * import struct             # <<<<<<<<<<<<<<
@@ -41514,7 +38890,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":10
+  /* "csamtools.pyx":10
  * import itertools
  * import struct
  * import ctypes             # <<<<<<<<<<<<<<
@@ -41526,7 +38902,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ctypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":11
+  /* "csamtools.pyx":11
  * import struct
  * import ctypes
  * import collections             # <<<<<<<<<<<<<<
@@ -41538,7 +38914,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__collections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":12
+  /* "csamtools.pyx":12
  * import ctypes
  * import collections
  * import re             # <<<<<<<<<<<<<<
@@ -41550,7 +38926,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":13
+  /* "csamtools.pyx":13
  * import collections
  * import re
  * import platform             # <<<<<<<<<<<<<<
@@ -41562,7 +38938,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__platform, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":14
+  /* "csamtools.pyx":14
  * import re
  * import platform
  * import warnings             # <<<<<<<<<<<<<<
@@ -41574,7 +38950,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":23
+  /* "csamtools.pyx":23
  * ## Python 3 compatibility functions
  * ########################################################################
  * IS_PYTHON3 = PY_MAJOR_VERSION >= 3             # <<<<<<<<<<<<<<
@@ -41586,7 +38962,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IS_PYTHON3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":32
+  /* "csamtools.pyx":32
  * # filename encoding (copied from lxml.etree.pyx)
  * cdef str _FILENAME_ENCODING
  * _FILENAME_ENCODING = sys.getfilesystemencoding()             # <<<<<<<<<<<<<<
@@ -41602,23 +38978,23 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_XGOTREF(((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
-  __Pyx_DECREF(((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
+  __Pyx_XGOTREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
+  __Pyx_DECREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
   __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_v_5pysam_9csamtools__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
+  __pyx_v_9csamtools__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":33
+  /* "csamtools.pyx":33
  * cdef str _FILENAME_ENCODING
  * _FILENAME_ENCODING = sys.getfilesystemencoding()
  * if _FILENAME_ENCODING is None:             # <<<<<<<<<<<<<<
  *     _FILENAME_ENCODING = sys.getdefaultencoding()
  * if _FILENAME_ENCODING is None:
  */
-  __pyx_t_3 = (__pyx_v_5pysam_9csamtools__FILENAME_ENCODING == ((PyObject*)Py_None));
+  __pyx_t_3 = (__pyx_v_9csamtools__FILENAME_ENCODING == ((PyObject*)Py_None));
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":34
+    /* "csamtools.pyx":34
  * _FILENAME_ENCODING = sys.getfilesystemencoding()
  * if _FILENAME_ENCODING is None:
  *     _FILENAME_ENCODING = sys.getdefaultencoding()             # <<<<<<<<<<<<<<
@@ -41634,26 +39010,26 @@ PyMODINIT_FUNC PyInit_csamtools(void)
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XGOTREF(((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
-    __Pyx_DECREF(((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
+    __Pyx_XGOTREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
+    __Pyx_DECREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
     __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_v_5pysam_9csamtools__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
+    __pyx_v_9csamtools__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
     __pyx_t_1 = 0;
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "pysam/csamtools.pyx":35
+  /* "csamtools.pyx":35
  * if _FILENAME_ENCODING is None:
  *     _FILENAME_ENCODING = sys.getdefaultencoding()
  * if _FILENAME_ENCODING is None:             # <<<<<<<<<<<<<<
  *     _FILENAME_ENCODING = 'ascii'
  * 
  */
-  __pyx_t_3 = (__pyx_v_5pysam_9csamtools__FILENAME_ENCODING == ((PyObject*)Py_None));
+  __pyx_t_3 = (__pyx_v_9csamtools__FILENAME_ENCODING == ((PyObject*)Py_None));
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":36
+    /* "csamtools.pyx":36
  *     _FILENAME_ENCODING = sys.getdefaultencoding()
  * if _FILENAME_ENCODING is None:
  *     _FILENAME_ENCODING = 'ascii'             # <<<<<<<<<<<<<<
@@ -41661,24 +39037,24 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  * #cdef char* _C_FILENAME_ENCODING
  */
     __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
-    __Pyx_XGOTREF(((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
-    __Pyx_DECREF(((PyObject *)__pyx_v_5pysam_9csamtools__FILENAME_ENCODING));
+    __Pyx_XGOTREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
+    __Pyx_DECREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
     __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
-    __pyx_v_5pysam_9csamtools__FILENAME_ENCODING = __pyx_n_s__ascii;
+    __pyx_v_9csamtools__FILENAME_ENCODING = __pyx_n_s__ascii;
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "pysam/csamtools.pyx":138
+  /* "csamtools.pyx":138
  * DEF BAM_CDIFF      = 8
  * 
  * cdef char* CODE2CIGAR= "MIDNSHP=X"             # <<<<<<<<<<<<<<
  * if IS_PYTHON3:
  *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
  */
-  __pyx_v_5pysam_9csamtools_CODE2CIGAR = __pyx_k_250;
+  __pyx_v_9csamtools_CODE2CIGAR = __pyx_k_250;
 
-  /* "pysam/csamtools.pyx":139
+  /* "csamtools.pyx":139
  * 
  * cdef char* CODE2CIGAR= "MIDNSHP=X"
  * if IS_PYTHON3:             # <<<<<<<<<<<<<<
@@ -41691,17 +39067,17 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":140
+    /* "csamtools.pyx":140
  * cdef char* CODE2CIGAR= "MIDNSHP=X"
  * if IS_PYTHON3:
  *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )             # <<<<<<<<<<<<<<
  * else:
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
  */
-    __pyx_t_1 = __pyx_pf_5pysam_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;
@@ -41714,17 +39090,17 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   }
   /*else*/ {
 
-    /* "pysam/csamtools.pyx":142
+    /* "csamtools.pyx":142
  *     CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
  * else:
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )             # <<<<<<<<<<<<<<
  * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )
  * 
  */
-    __pyx_t_1 = __pyx_pf_5pysam_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;
@@ -41736,7 +39112,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   }
   __pyx_L4:;
 
-  /* "pysam/csamtools.pyx":143
+  /* "csamtools.pyx":143
  * else:
  *     CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
  * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )             # <<<<<<<<<<<<<<
@@ -41754,7 +39130,7 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CIGAR_REGEX, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":147
+  /* "csamtools.pyx":147
  * #####################################################################
  * ## set pysam stderr to /dev/null
  * pysam_unset_stderr()             # <<<<<<<<<<<<<<
@@ -41763,25 +39139,25 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  */
   pysam_unset_stderr();
 
-  /* "pysam/csamtools.pyx":151
+  /* "csamtools.pyx":151
  * #####################################################################
  * # hard-coded constants
  * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"             # <<<<<<<<<<<<<<
  * cdef int max_pos = 2 << 29
  * 
  */
-  __pyx_v_5pysam_9csamtools_bam_nt16_rev_table = __pyx_k_253;
+  __pyx_v_9csamtools_bam_nt16_rev_table = __pyx_k_253;
 
-  /* "pysam/csamtools.pyx":152
+  /* "csamtools.pyx":152
  * # hard-coded constants
  * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"
  * cdef int max_pos = 2 << 29             # <<<<<<<<<<<<<<
  * 
  * #####################################################################
  */
-  __pyx_v_5pysam_9csamtools_max_pos = 1073741824;
+  __pyx_v_9csamtools_max_pos = 1073741824;
 
-  /* "pysam/csamtools.pyx":247
+  /* "csamtools.pyx":247
  *     (<object>f)(a)
  * 
  * class PileupColumn(object):             # <<<<<<<<<<<<<<
@@ -41791,19 +39167,19 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
-  /* "pysam/csamtools.pyx":260
+  /* "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_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_12PileupColumn_1__str__, 0, NULL, __pyx_n_s_257, ((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;
 
-  /* "pysam/csamtools.pyx":247
+  /* "csamtools.pyx":247
  *     (<object>f)(a)
  * 
  * class PileupColumn(object):             # <<<<<<<<<<<<<<
@@ -41811,19 +39187,19 @@ 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_258)) < 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_257); if (unlikely(!__pyx_t_4)) {__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;
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PileupColumn, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":304
+  /* "csamtools.pyx":304
  *     return 0
  * 
  * class StderrStore():             # <<<<<<<<<<<<<<
@@ -41833,69 +39209,69 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
-  /* "pysam/csamtools.pyx":308
+  /* "csamtools.pyx":308
  *     stderr is captured.
  *     '''
  *     def __init__(self):             # <<<<<<<<<<<<<<
  *         return
  *         self.stderr_h, self.stderr_f = tempfile.mkstemp()
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_11StderrStore_1__init__, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_260)); 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;
 
-  /* "pysam/csamtools.pyx":314
+  /* "csamtools.pyx":314
  *         self.stderr_save.setfd( self.stderr_h )
  * 
  *     def readAndRelease( self ):             # <<<<<<<<<<<<<<
  *         return []
  *         self.stderr_save.restore()
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_11StderrStore_3readAndRelease, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_262)); 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;
 
-  /* "pysam/csamtools.pyx":323
+  /* "csamtools.pyx":323
  *         return lines
  * 
  *     def release(self):             # <<<<<<<<<<<<<<
  *         return
  *         self.stderr_save.restore()
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_11StderrStore_5release, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_264)); 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;
 
-  /* "pysam/csamtools.pyx":329
+  /* "csamtools.pyx":329
  *             os.remove( self.stderr_f )
  * 
  *     def __del__(self):             # <<<<<<<<<<<<<<
  *         self.release()
  * 
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_11StderrStore_7__del__, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_266)); 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;
 
-  /* "pysam/csamtools.pyx":304
+  /* "csamtools.pyx":304
  *     return 0
  * 
  * class StderrStore():             # <<<<<<<<<<<<<<
  *     '''
  *     stderr is captured.
  */
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_267)) < 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_257); if (unlikely(!__pyx_t_4)) {__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;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":332
+  /* "csamtools.pyx":332
  *         self.release()
  * 
  * class StderrStoreWindows():             # <<<<<<<<<<<<<<
@@ -41905,57 +39281,57 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
-  /* "pysam/csamtools.pyx":334
+  /* "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_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_18StderrStoreWindows_1__init__, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_269)); 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;
 
-  /* "pysam/csamtools.pyx":335
+  /* "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_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_18StderrStoreWindows_3readAndRelease, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_271)); 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;
 
-  /* "pysam/csamtools.pyx":336
+  /* "csamtools.pyx":336
  *     def __init__(self): pass
  *     def readAndRelease(self): return []
  *     def release(self): pass             # <<<<<<<<<<<<<<
  * 
  * if platform.system()=='Windows':
  */
-  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_18StderrStoreWindows_5release, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_273)); 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;
 
-  /* "pysam/csamtools.pyx":332
+  /* "csamtools.pyx":332
  *         self.release()
  * 
  * class StderrStoreWindows():             # <<<<<<<<<<<<<<
  *     '''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_274)) < 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_257); if (unlikely(!__pyx_t_4)) {__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;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":338
+  /* "csamtools.pyx":338
  *     def release(self): pass
  * 
  * if platform.system()=='Windows':             # <<<<<<<<<<<<<<
@@ -41970,13 +39346,11 @@ PyMODINIT_FUNC PyInit_csamtools(void)
   __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Windows), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Windows), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (__pyx_t_3) {
 
-    /* "pysam/csamtools.pyx":339
+    /* "csamtools.pyx":339
  * 
  * if platform.system()=='Windows':
  *     del StderrStore             # <<<<<<<<<<<<<<
@@ -41985,447 +39359,446 @@ PyMODINIT_FUNC PyInit_csamtools(void)
  */
     if (__Pyx_DelAttrString(__pyx_m, "StderrStore") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "pysam/csamtools.pyx":340
+    /* "csamtools.pyx":340
  * if platform.system()=='Windows':
  *     del StderrStore
  *     StderrStore = StderrStoreWindows             # <<<<<<<<<<<<<<
  * 
  * 
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStoreWindows); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __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 = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStoreWindows); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "pysam/csamtools.pyx":347
+  /* "csamtools.pyx":347
  * ######################################################################
  * # valid types for sam headers
  * VALID_HEADER_TYPES = { "HD" : dict,             # <<<<<<<<<<<<<<
  *                        "SQ" : list,
  *                        "RG" : list,
  */
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__HD), ((PyObject *)((PyObject*)(&PyDict_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __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 *)((PyObject*)(&PyDict_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":348
+  /* "csamtools.pyx":348
  * # valid types for sam headers
  * VALID_HEADER_TYPES = { "HD" : dict,
  *                        "SQ" : list,             # <<<<<<<<<<<<<<
  *                        "RG" : list,
  *                        "PG" : list,
  */
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":349
+  /* "csamtools.pyx":349
  * VALID_HEADER_TYPES = { "HD" : dict,
  *                        "SQ" : list,
  *                        "RG" : list,             # <<<<<<<<<<<<<<
  *                        "PG" : list,
  *                        "CO" : list }
  */
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__RG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":350
+  /* "csamtools.pyx":350
  *                        "SQ" : list,
  *                        "RG" : list,
  *                        "PG" : list,             # <<<<<<<<<<<<<<
  *                        "CO" : list }
  * 
  */
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":351
+  /* "csamtools.pyx":351
  *                        "RG" : list,
  *                        "PG" : list,
  *                        "CO" : list }             # <<<<<<<<<<<<<<
  * 
  * # order of records within sam headers
  */
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__CO), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CO), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":354
+  /* "csamtools.pyx":354
  * 
  * # order of records within sam headers
  * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" )             # <<<<<<<<<<<<<<
  * 
  * # type conversions within sam header records
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, ((PyObject *)__pyx_k_tuple_275)) < 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;}
 
-  /* "pysam/csamtools.pyx":357
+  /* "csamtools.pyx":357
  * 
  * # type conversions within sam header records
  * 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,
  */
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__GO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__GO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((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;
 
-  /* "pysam/csamtools.pyx":358
+  /* "csamtools.pyx":358
  * # type conversions within sam header records
  * 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" : str,},
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LN), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__AS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__M5), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__UR), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __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));
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__LN), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__AS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__M5), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__UR), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((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;
 
-  /* "pysam/csamtools.pyx":359
+  /* "csamtools.pyx":359
  * 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" : str,},
  *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str }, }
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((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__SM), ((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__LB), ((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__DS), ((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__PU), ((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__PI), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "pysam/csamtools.pyx":360
+  __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));
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__ID), ((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__SM), ((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__LB), ((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__DS), ((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__PU), ((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__PI), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "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" : str,},             # <<<<<<<<<<<<<<
  *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str }, }
  * 
  */
-  if (PyDict_SetItem(__pyx_t_1, ((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;}
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DT), ((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__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_1, ((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_1, ((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_1, ((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_4, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  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;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__DT), ((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__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;
 
-  /* "pysam/csamtools.pyx":361
+  /* "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" : str,},
  *                         "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str, "PP" : str }, }             # <<<<<<<<<<<<<<
  * 
  * # output order of fields within records
  */
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PN), ((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__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_1, ((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_1, ((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_1, ((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_4, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PN), ((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__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;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":364
+  /* "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", "PG" ),
  */
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_k_tuple_276)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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_258)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":365
+  /* "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" ),
  *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
  */
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SQ), ((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__SQ), ((PyObject *)__pyx_k_tuple_259)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":366
+  /* "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" ),             # <<<<<<<<<<<<<<
  *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }
  * 
  */
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__RG), ((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__RG), ((PyObject *)__pyx_k_tuple_260)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "pysam/csamtools.pyx":367
+  /* "csamtools.pyx":367
  *                        "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
  *                        "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS", "PG" ),
  *                        "PG" : ( "PN", "ID", "VN", "CL", "PP" ), }             # <<<<<<<<<<<<<<
  * 
  * 
  */
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_k_tuple_279)) < 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_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  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;
 
-  /* "pysam/csamtools.pyx":619
+  /* "csamtools.pyx":619
  *                header = None,
  *                port = None,
  *                add_sq_text = True,             # <<<<<<<<<<<<<<
  *                check_header = True,
  *                check_sq = True,
  */
-  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_k_21 = __pyx_t_4;
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_21 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":620
+  /* "csamtools.pyx":620
  *                port = None,
  *                add_sq_text = True,
  *                check_header = True,             # <<<<<<<<<<<<<<
  *                check_sq = True,
  *               ):
  */
-  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_k_22 = __pyx_t_4;
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_22 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":621
+  /* "csamtools.pyx":621
  *                add_sq_text = True,
  *                check_header = True,
  *                check_sq = True,             # <<<<<<<<<<<<<<
  *               ):
  *         '''open a sam/bam file.
  */
-  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_k_23 = __pyx_t_4;
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_23 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":900
+  /* "csamtools.pyx":900
  *                region = None,
  *                callback = None,
  *                until_eof = False ):             # <<<<<<<<<<<<<<
  *         '''
  *         fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by
  */
-  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_k_54 = __pyx_t_4;
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_54 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":1020
+  /* "csamtools.pyx":1020
  *                end = None,
  *                region = None,
  *                until_eof = False ):             # <<<<<<<<<<<<<<
  *         '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
  * 
  */
-  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_k_73 = __pyx_t_4;
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_73 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":1937
+  /* "csamtools.pyx":1937
  *                   int tid = 0,
  *                   int start = 0,
  *                   int end = max_pos,             # <<<<<<<<<<<<<<
  *                   int truncate = False,
  *                   **kwargs ):
  */
-  __pyx_k_128 = __pyx_v_5pysam_9csamtools_max_pos;
+  __pyx_k_128 = __pyx_v_9csamtools_max_pos;
 
-  /* "pysam/csamtools.pyx":3090
+  /* "csamtools.pyx":3090
  *             return self._level
  * 
  * class Outs:             # <<<<<<<<<<<<<<
  *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
  *     def __init__(self, id = 1):
  */
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
 
-  /* "pysam/csamtools.pyx":3092
+  /* "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_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_4Outs_1__init__, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_281)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_282));
-  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __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);
+  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;
 
-  /* "pysam/csamtools.pyx":3096
+  /* "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_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_4Outs_3setdevice, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_284)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s__setdevice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __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;
 
-  /* "pysam/csamtools.pyx":3101
+  /* "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_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_4Outs_5setfile, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_286)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s__setfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __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;
 
-  /* "pysam/csamtools.pyx":3106
+  /* "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_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_4Outs_7setfd, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_288)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s__setfd, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __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;
 
-  /* "pysam/csamtools.pyx":3114
+  /* "csamtools.pyx":3114
  *         os.close(fd)                #  Close other unit (look out, caller.)
  * 
  *     def restore(self):             # <<<<<<<<<<<<<<
  *         '''restore previous output stream'''
  *         if self.streams:
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_4Outs_9restore, 0, NULL, __pyx_n_s_257, ((PyObject *)__pyx_k_codeobj_290)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetItem(__pyx_t_4, __pyx_n_s__restore, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __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;
 
-  /* "pysam/csamtools.pyx":3090
+  /* "csamtools.pyx":3090
  *             return self._level
  * 
  * class Outs:             # <<<<<<<<<<<<<<
  *     '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
  *     def __init__(self, id = 1):
  */
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_291)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4), __pyx_n_s__Outs, __pyx_n_s_257); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Outs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  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;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":3127
+  /* "csamtools.pyx":3127
  * def _samtools_dispatch( method,
  *                         args = (),
  *                         catch_stdout = True ):             # <<<<<<<<<<<<<<
  *     '''call ``method`` in samtools providing arguments in args.
  * 
  */
-  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_k_176 = __pyx_t_4;
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
+  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_176 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":3125
+  /* "csamtools.pyx":3125
  *             del self.streams[-1]
  * 
  * def _samtools_dispatch( method,             # <<<<<<<<<<<<<<
  *                         args = (),
  *                         catch_stdout = True ):
  */
-  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_5pysam_9csamtools_1_samtools_dispatch, NULL, __pyx_n_s_257); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___samtools_dispatch, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __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;
 
-  /* "pysam/csamtools.pyx":3836
+  /* "csamtools.pyx":3836
  *         if self.owns_samfile: samclose( self.fp )
  * 
  * __all__ = ["Samfile",             # <<<<<<<<<<<<<<
  *            "Fastafile",
  *            "IteratorRow",
  */
-  __pyx_t_4 = PyList_New(9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __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(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Samfile));
-  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__Samfile));
+  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Samfile));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Samfile));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__Fastafile));
-  PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__Fastafile));
+  PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__Fastafile));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Fastafile));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorRow));
-  PyList_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_n_s__IteratorRow));
+  PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__IteratorRow));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorRow));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorColumn));
-  PyList_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_n_s__IteratorColumn));
+  PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__IteratorColumn));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorColumn));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__AlignedRead));
-  PyList_SET_ITEM(__pyx_t_4, 4, ((PyObject *)__pyx_n_s__AlignedRead));
+  PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__AlignedRead));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AlignedRead));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupColumn));
-  PyList_SET_ITEM(__pyx_t_4, 5, ((PyObject *)__pyx_n_s__PileupColumn));
+  PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__PileupColumn));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupColumn));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupProxy));
-  PyList_SET_ITEM(__pyx_t_4, 6, ((PyObject *)__pyx_n_s__PileupProxy));
+  PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__PileupProxy));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupProxy));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupRead));
-  PyList_SET_ITEM(__pyx_t_4, 7, ((PyObject *)__pyx_n_s__PileupRead));
+  PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__PileupRead));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupRead));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__IndexedReads));
-  PyList_SET_ITEM(__pyx_t_4, 8, ((PyObject *)__pyx_n_s__IndexedReads));
+  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__IndexedReads));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IndexedReads));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3836; __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____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "pysam/csamtools.pyx":1
+  /* "csamtools.pyx":1
  * # cython: embedsignature=True             # <<<<<<<<<<<<<<
  * # cython: profile=True
  * # adds doc-strings for sphinx
  */
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_4);
   if (__pyx_m) {
-    __Pyx_AddTraceback("init pysam.csamtools", __pyx_clineno, __pyx_lineno, __pyx_filename);
+    __Pyx_AddTraceback("init csamtools", __pyx_clineno, __pyx_lineno, __pyx_filename);
     Py_DECREF(__pyx_m); __pyx_m = 0;
   } else if (!PyErr_Occurred()) {
-    PyErr_SetString(PyExc_ImportError, "init pysam.csamtools");
+    PyErr_SetString(PyExc_ImportError, "init csamtools");
   }
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -42437,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;
@@ -42468,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,
@@ -42492,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);
@@ -42504,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
@@ -42523,43 +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 PyObject* __Pyx_decode_c_string(
-         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
-         const char* encoding, const char* errors,
-         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
-    Py_ssize_t length;
-    if (unlikely((start < 0) | (stop < 0))) {
-        length = strlen(cstring);
-        if (start < 0) {
-            start += length;
-            if (start < 0)
-                start = 0;
-        }
-        if (stop < 0)
-            stop += length;
-    }
-    length = stop - start;
-    if (unlikely(length <= 0))
-        return PyUnicode_FromUnicode(NULL, 0);
-    cstring += start;
-    if (decode_func) {
-        return decode_func(cstring, length, errors);
-    } else {
-        return PyUnicode_Decode(cstring, length, encoding, errors);
-    }
-}
+#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;
@@ -42569,60 +39925,55 @@ 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);
-    if (!value || value == Py_None)
-        value = NULL;
-    else
+    Py_XINCREF(value);
+    Py_XINCREF(tb);
+    /* First, check the traceback argument, replacing None with NULL. */
+    if (tb == Py_None) {
+        Py_DECREF(tb);
+        tb = 0;
+    }
+    else if (tb != NULL && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "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);
-    if (!tb || tb == Py_None)
-        tb = NULL;
-    else {
-        Py_INCREF(tb);
-        if (!PyTraceBack_Check(tb)) {
-            PyErr_SetString(PyExc_TypeError,
-                "raise: arg 3 must be a traceback or None");
-            goto raise_error;
-        }
     }
     #if PY_VERSION_HEX < 0x02050000
-    if (PyClass_Check(type)) {
+    if (!PyClass_Check(type))
     #else
-    if (PyType_Check(type)) {
+    if (!PyType_Check(type))
     #endif
-#if CYTHON_COMPILING_IN_PYPY
-        if (!value) {
-            Py_INCREF(Py_None);
-            value = Py_None;
-        }
-#endif
-        PyErr_NormalizeException(&type, &value, &tb);
-    } else {
-        if (value) {
+    {
+        /* 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
             if (PyInstance_Check(type)) {
@@ -42645,6 +39996,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
             }
         #endif
     }
+
     __Pyx_ErrRestore(type, value, tb);
     return;
 raise_error:
@@ -42653,9 +40005,10 @@ raise_error:
     Py_XDECREF(tb);
     return;
 }
+
 #else /* Python 3+ */
+
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
-    PyObject* owned_instance = NULL;
     if (tb == Py_None) {
         tb = 0;
     } else if (tb && !PyTraceBack_Check(tb)) {
@@ -42665,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,
@@ -42673,36 +40027,13 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
         value = type;
         type = (PyObject*) Py_TYPE(value);
-    } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
-        }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
-        }
-    } else {
+    } else if (!PyExceptionClass_Check(type)) {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
-    if (cause && cause != Py_None) {
+
+    if (cause) {
         PyObject *fixed_cause;
         if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
@@ -42719,9 +40050,14 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
                             "BaseException");
             goto bad;
         }
+        if (!value) {
+            value = PyObject_CallObject(type, NULL);
+        }
         PyException_SetCause(value, fixed_cause);
     }
+
     PyErr_SetObject(type, value);
+
     if (tb) {
         PyThreadState *tstate = PyThreadState_GET();
         PyObject* tmp_tb = tstate->curexc_traceback;
@@ -42731,8 +40067,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
             Py_XDECREF(tmp_tb);
         }
     }
+
 bad:
-    Py_XDECREF(owned_instance);
     return;
 }
 #endif
@@ -42756,17 +40092,13 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
 {
     PyObject* key = 0;
     Py_ssize_t pos = 0;
-#if CPYTHON_COMPILING_IN_PYPY
-    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
-        goto invalid_keyword;
-    return 1;
-#else
     while (PyDict_Next(kwdict, &pos, &key, 0)) {
         #if PY_MAJOR_VERSION < 3
         if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
+        #else
+        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
         #endif
-            if (unlikely(!PyUnicode_Check(key)))
-                goto invalid_keyword_type;
+            goto invalid_keyword_type;
     }
     if ((!kw_allowed) && unlikely(key))
         goto invalid_keyword;
@@ -42775,7 +40107,6 @@ invalid_keyword_type:
     PyErr_Format(PyExc_TypeError,
         "%s() keywords must be strings", function_name);
     return 0;
-#endif
 invalid_keyword:
     PyErr_Format(PyExc_TypeError,
     #if PY_MAJOR_VERSION < 3
@@ -42797,7 +40128,7 @@ static void __Pyx_RaiseDoubleKeywordsError(
         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
         #else
         "%s() got multiple values for keyword argument '%s'", func_name,
-        PyString_AsString(kw_name));
+        PyString_AS_STRING(kw_name));
         #endif
 }
 
@@ -42813,77 +40144,55 @@ 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++;
         if (*name) {
             values[name-argnames] = value;
-            continue;
-        }
-        name = first_kw_arg;
-        #if PY_MAJOR_VERSION < 3
-        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
-            while (*name) {
-                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
-                        && _PyString_Eq(**name, key)) {
-                    values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    if ((**argname == key) || (
-                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
-                             && _PyString_Eq(**argname, key))) {
-                        goto arg_passed_twice;
-                    }
-                    argname++;
+        } else {
+            #if PY_MAJOR_VERSION < 3
+            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
+            #else
+            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
+            #endif
+                goto invalid_keyword_type;
+            } else {
+                for (name = first_kw_arg; *name; name++) {
+                    #if PY_MAJOR_VERSION >= 3
+                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                        PyUnicode_Compare(**name, key) == 0) break;
+                    #else
+                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                        _PyString_Eq(**name, key)) break;
+                    #endif
                 }
-            }
-        } else
-        #endif
-        if (likely(PyUnicode_Check(key))) {
-            while (*name) {
-                int cmp = (**name == key) ? 0 :
-                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
-                #endif
-                    PyUnicode_Compare(**name, key);
-                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                if (cmp == 0) {
+                if (*name) {
                     values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    int cmp = (**argname == key) ? 0 :
-                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
-                    #endif
-                        PyUnicode_Compare(**argname, key);
-                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                    if (cmp == 0) goto arg_passed_twice;
-                    argname++;
+                } else {
+                    /* unexpected keyword found */
+                    for (name=argnames; name != first_kw_arg; name++) {
+                        if (**name == key) goto arg_passed_twice;
+                        #if PY_MAJOR_VERSION >= 3
+                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
+                        #else
+                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                            _PyString_Eq(**name, key)) goto arg_passed_twice;
+                        #endif
+                    }
+                    if (kwds2) {
+                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+                    } else {
+                        goto invalid_keyword;
+                    }
                 }
             }
-        } else
-            goto invalid_keyword_type;
-        if (kwds2) {
-            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
-        } else {
-            goto invalid_keyword;
         }
     }
     return 0;
 arg_passed_twice:
-    __Pyx_RaiseDoubleKeywordsError(function_name, key);
+    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
     goto bad;
 invalid_keyword_type:
     PyErr_Format(PyExc_TypeError,
@@ -42911,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";
@@ -42922,7 +40232,7 @@ static void __Pyx_RaiseArgtupleInvalid(
         more_or_less = "exactly";
     }
     PyErr_Format(PyExc_TypeError,
-                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                  func_name, more_or_less, num_expected,
                  (num_expected == 1) ? "" : "s", num_found);
 }
@@ -42949,7 +40259,6 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
     PyObject *local_type, *local_value, *local_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
     local_type = tstate->curexc_type;
@@ -42958,27 +40267,19 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     tstate->curexc_type = 0;
     tstate->curexc_value = 0;
     tstate->curexc_traceback = 0;
-#else
-    PyErr_Fetch(&local_type, &local_value, &local_tb);
-#endif
     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
-#if CYTHON_COMPILING_IN_CPYTHON
     if (unlikely(tstate->curexc_type))
-#else
-    if (unlikely(PyErr_Occurred()))
-#endif
         goto bad;
     #if PY_MAJOR_VERSION >= 3
     if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
         goto bad;
     #endif
-    Py_INCREF(local_type);
-    Py_INCREF(local_value);
-    Py_INCREF(local_tb);
     *type = local_type;
     *value = local_value;
     *tb = local_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
+    Py_INCREF(local_type);
+    Py_INCREF(local_value);
+    Py_INCREF(local_tb);
     tmp_type = tstate->exc_type;
     tmp_value = tstate->exc_value;
     tmp_tb = tstate->exc_traceback;
@@ -42986,13 +40287,10 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     tstate->exc_value = local_value;
     tstate->exc_traceback = local_tb;
     /* Make sure tstate is in a consistent state when we XDECREF
-       these objects (DECREF may run arbitrary code). */
+       these objects (XDECREF may run arbitrary code). */
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
-#else
-    PyErr_SetExcInfo(local_type, local_value, local_tb);
-#endif
     return 0;
 bad:
     *type = 0;
@@ -43004,40 +40302,25 @@ bad:
     return -1;
 }
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
-    PyErr_Format(PyExc_ValueError,
-                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
-}
+
 
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
     PyErr_Format(PyExc_ValueError,
-                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
+                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                  index, (index == 1) ? "" : "s");
 }
 
-static CYTHON_INLINE int __Pyx_IterFinish(void) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyThreadState *tstate = PyThreadState_GET();
-    PyObject* exc_type = tstate->curexc_type;
-    if (unlikely(exc_type)) {
-        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
-            PyObject *exc_value, *exc_tb;
-            exc_value = tstate->curexc_value;
-            exc_tb = tstate->curexc_traceback;
-            tstate->curexc_type = 0;
-            tstate->curexc_value = 0;
-            tstate->curexc_traceback = 0;
-            Py_DECREF(exc_type);
-            Py_XDECREF(exc_value);
-            Py_XDECREF(exc_tb);
-            return 0;
-        } else {
-            return -1;
-        }
-    }
-    return 0;
-#else
-    if (unlikely(PyErr_Occurred())) {
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+    PyErr_Format(PyExc_ValueError,
+                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
+}
+
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
+    if (unlikely(retval)) {
+        Py_DECREF(retval);
+        __Pyx_RaiseTooManyValuesError(expected);
+        return -1;
+    } else if (PyErr_Occurred()) {
         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
             PyErr_Clear();
             return 0;
@@ -43046,18 +40329,10 @@ static CYTHON_INLINE int __Pyx_IterFinish(void) {
         }
     }
     return 0;
-#endif
 }
 
-static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
-    if (unlikely(retval)) {
-        Py_DECREF(retval);
-        __Pyx_RaiseTooManyValuesError(expected);
-        return -1;
-    } else {
-        return __Pyx_IterFinish();
-    }
-    return 0;
+static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
 }
 
 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
@@ -43077,25 +40352,8 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
 }
 
-static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
-    PyTypeObject* type = Py_TYPE(obj);
-    while (type && type->tp_traverse != current_tp_traverse)
-        type = type->tp_base;
-    if (type && type->tp_base && type->tp_base->tp_traverse)
-        return type->tp_base->tp_traverse(obj, v, a);
-    return 0;
-}
-
-static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
-    PyTypeObject* type = Py_TYPE(obj);
-    while (type && type->tp_clear != current_tp_clear)
-        type = type->tp_base;
-    if (type && type->tp_base && type->tp_base->tp_clear)
-        type->tp_base->tp_clear(obj);
-}
 
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
     *type = tstate->exc_type;
     *value = tstate->exc_value;
@@ -43103,12 +40361,9 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value,
     Py_XINCREF(*type);
     Py_XINCREF(*value);
     Py_XINCREF(*tb);
-#else
-    PyErr_GetExcInfo(type, value, tb);
-#endif
 }
+
 static void __Pyx_ExceptionReset(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->exc_type;
@@ -43120,9 +40375,6 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
-#else
-    PyErr_SetExcInfo(type, value, tb);
-#endif
 }
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
@@ -43151,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) {
@@ -43196,6 +40427,7 @@ bad:
 
 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
     PyObject *metaclass;
+    /* Default metaclass */
 #if PY_MAJOR_VERSION < 3
     if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
         PyObject *base = PyTuple_GET_ITEM(bases, 0);
@@ -43223,8 +40455,11 @@ 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) {
         Py_INCREF(metaclass);
@@ -43236,526 +40471,105 @@ 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;
+    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;
-}
-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
-}
-#if CYTHON_COMPILING_IN_PYPY
-static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
-    PyCFunctionObject* f = (PyCFunctionObject*)func;
-    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
-    PyObject *self = PyCFunction_GET_SELF(func);
-    Py_ssize_t size;
-    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
-    case METH_VARARGS:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
-            return (*meth)(self, arg);
-        break;
-    case METH_VARARGS | METH_KEYWORDS:
-        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
-    case METH_NOARGS:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
-            size = PyTuple_GET_SIZE(arg);
-            if (size == 0)
-                return (*meth)(self, NULL);
-            PyErr_Format(PyExc_TypeError,
-                "%.200s() takes no arguments (%zd given)",
-                f->m_ml->ml_name, size);
-            return NULL;
-        }
-        break;
-    case METH_O:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
-            size = PyTuple_GET_SIZE(arg);
-            if (size == 1)
-                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
-            PyErr_Format(PyExc_TypeError,
-                "%.200s() takes exactly one argument (%zd given)",
-                f->m_ml->ml_name, size);
-            return NULL;
-        }
-        break;
-    default:
-        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
-                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
-                        "longer supported!");
-        return NULL;
-    }
-    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
-                 f->m_ml->ml_name);
-    return NULL;
-}
-#else
-static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
-	return PyCFunction_Call(func, arg, kw);
-}
-#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_CyFunction_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 !CYTHON_COMPILING_IN_PYPY
-    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
-#endif
-    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;
-}
-static CYTHON_INLINE 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 CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
-    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-    m->defaults_tuple = tuple;
-    Py_INCREF(tuple);
+
 }
 
-static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject* x) {
-    const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0;
-    const int is_unsigned = const_zero < neg_one;
-    if (sizeof(uint64_t) == sizeof(char)) {
-        if (is_unsigned)
-            return (uint64_t)__Pyx_PyInt_AsUnsignedChar(x);
-        else
-            return (uint64_t)__Pyx_PyInt_AsSignedChar(x);
-    } else if (sizeof(uint64_t) == sizeof(short)) {
-        if (is_unsigned)
-            return (uint64_t)__Pyx_PyInt_AsUnsignedShort(x);
-        else
-            return (uint64_t)__Pyx_PyInt_AsSignedShort(x);
-    } else if (sizeof(uint64_t) == sizeof(int)) {
-        if (is_unsigned)
-            return (uint64_t)__Pyx_PyInt_AsUnsignedInt(x);
-        else
-            return (uint64_t)__Pyx_PyInt_AsSignedInt(x);
-    } else if (sizeof(uint64_t) == sizeof(long)) {
-        if (is_unsigned)
-            return (uint64_t)__Pyx_PyInt_AsUnsignedLong(x);
-        else
-            return (uint64_t)__Pyx_PyInt_AsSignedLong(x);
-    } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) {
-        if (is_unsigned)
-            return (uint64_t)__Pyx_PyInt_AsUnsignedLongLong(x);
-        else
-            return (uint64_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
-        uint64_t val;
-        PyObject *v = __Pyx_PyNumber_Int(x);
-        #if PY_VERSION_HEX < 0x03000000
-        if (likely(v) && !PyLong_Check(v)) {
-            PyObject *tmp = v;
-            v = PyNumber_Long(tmp);
-            Py_DECREF(tmp);
-        }
-        #endif
-        if (likely(v)) {
-            int one = 1; int is_little = (int)*(unsigned char *)&one;
-            unsigned char *bytes = (unsigned char *)&val;
-            int ret = _PyLong_AsByteArray((PyLongObject *)v,
-                                          bytes, sizeof(val),
-                                          is_little, !is_unsigned);
-            Py_DECREF(v);
-            if (likely(!ret))
-                return val;
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
+    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)) {
+            return (equals == Py_NE);
+        } else if (PyBytes_GET_SIZE(s1) == 1) {
+            if (equals == Py_EQ)
+                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
+            else
+                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
+        } else {
+            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
+            return (equals == Py_EQ) ? (result == 0) : (result != 0);
         }
-        #endif
-        return (uint64_t)-1;
+    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
+        return (equals == Py_NE);
+    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
+        return (equals == Py_NE);
+    } else {
+        int result;
+        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+        if (!py_result)
+            return -1;
+        result = __Pyx_PyObject_IsTrue(py_result);
+        Py_DECREF(py_result);
+        return result;
     }
 }
 
-static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject* x) {
-    const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
-    const int is_unsigned = const_zero < neg_one;
-    if (sizeof(uint32_t) == sizeof(char)) {
-        if (is_unsigned)
-            return (uint32_t)__Pyx_PyInt_AsUnsignedChar(x);
-        else
-            return (uint32_t)__Pyx_PyInt_AsSignedChar(x);
-    } else if (sizeof(uint32_t) == sizeof(short)) {
-        if (is_unsigned)
-            return (uint32_t)__Pyx_PyInt_AsUnsignedShort(x);
-        else
-            return (uint32_t)__Pyx_PyInt_AsSignedShort(x);
-    } else if (sizeof(uint32_t) == sizeof(int)) {
-        if (is_unsigned)
-            return (uint32_t)__Pyx_PyInt_AsUnsignedInt(x);
-        else
-            return (uint32_t)__Pyx_PyInt_AsSignedInt(x);
-    } else if (sizeof(uint32_t) == sizeof(long)) {
-        if (is_unsigned)
-            return (uint32_t)__Pyx_PyInt_AsUnsignedLong(x);
-        else
-            return (uint32_t)__Pyx_PyInt_AsSignedLong(x);
-    } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) {
-        if (is_unsigned)
-            return (uint32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
-        else
-            return (uint32_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
-        uint32_t val;
-        PyObject *v = __Pyx_PyNumber_Int(x);
-        #if PY_VERSION_HEX < 0x03000000
-        if (likely(v) && !PyLong_Check(v)) {
-            PyObject *tmp = v;
-            v = PyNumber_Long(tmp);
-            Py_DECREF(tmp);
-        }
-        #endif
-        if (likely(v)) {
-            int one = 1; int is_little = (int)*(unsigned char *)&one;
-            unsigned char *bytes = (unsigned char *)&val;
-            int ret = _PyLong_AsByteArray((PyLongObject *)v,
-                                          bytes, sizeof(val),
-                                          is_little, !is_unsigned);
-            Py_DECREF(v);
-            if (likely(!ret))
-                return val;
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
+    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 (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
+            return (equals == Py_NE);
+        } else if (PyUnicode_GET_SIZE(s1) == 1) {
+            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()))
+                return -1;
+            return (equals == Py_EQ) ? (result == 0) : (result != 0);
         }
-        #endif
-        return (uint32_t)-1;
+    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
+        return (equals == Py_NE);
+    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
+        return (equals == Py_NE);
+    } else {
+        int result;
+        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+        if (!py_result)
+            return -1;
+        result = __Pyx_PyObject_IsTrue(py_result);
+        Py_DECREF(py_result);
+        return result;
     }
 }
 
@@ -43909,6 +40723,58 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
     }
 }
 
+static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject* x) {
+    const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
+    const int is_unsigned = const_zero < neg_one;
+    if (sizeof(uint32_t) == sizeof(char)) {
+        if (is_unsigned)
+            return (uint32_t)__Pyx_PyInt_AsUnsignedChar(x);
+        else
+            return (uint32_t)__Pyx_PyInt_AsSignedChar(x);
+    } else if (sizeof(uint32_t) == sizeof(short)) {
+        if (is_unsigned)
+            return (uint32_t)__Pyx_PyInt_AsUnsignedShort(x);
+        else
+            return (uint32_t)__Pyx_PyInt_AsSignedShort(x);
+    } else if (sizeof(uint32_t) == sizeof(int)) {
+        if (is_unsigned)
+            return (uint32_t)__Pyx_PyInt_AsUnsignedInt(x);
+        else
+            return (uint32_t)__Pyx_PyInt_AsSignedInt(x);
+    } else if (sizeof(uint32_t) == sizeof(long)) {
+        if (is_unsigned)
+            return (uint32_t)__Pyx_PyInt_AsUnsignedLong(x);
+        else
+            return (uint32_t)__Pyx_PyInt_AsSignedLong(x);
+    } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) {
+        if (is_unsigned)
+            return (uint32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
+        else
+            return (uint32_t)__Pyx_PyInt_AsSignedLongLong(x);
+    }  else {
+        uint32_t val;
+        PyObject *v = __Pyx_PyNumber_Int(x);
+        #if PY_VERSION_HEX < 0x03000000
+        if (likely(v) && !PyLong_Check(v)) {
+            PyObject *tmp = v;
+            v = PyNumber_Long(tmp);
+            Py_DECREF(tmp);
+        }
+        #endif
+        if (likely(v)) {
+            int one = 1; int is_little = (int)*(unsigned char *)&one;
+            unsigned char *bytes = (unsigned char *)&val;
+            int ret = _PyLong_AsByteArray((PyLongObject *)v,
+                                          bytes, sizeof(val),
+                                          is_little, !is_unsigned);
+            Py_DECREF(v);
+            if (likely(!ret))
+                return val;
+        }
+        return (uint32_t)-1;
+    }
+}
+
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t val) {
     const int64_t neg_one = (int64_t)-1, const_zero = (int64_t)0;
     const int is_unsigned = const_zero < neg_one;
@@ -43934,6 +40800,58 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t val) {
     }
 }
 
+static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject* x) {
+    const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0;
+    const int is_unsigned = const_zero < neg_one;
+    if (sizeof(uint64_t) == sizeof(char)) {
+        if (is_unsigned)
+            return (uint64_t)__Pyx_PyInt_AsUnsignedChar(x);
+        else
+            return (uint64_t)__Pyx_PyInt_AsSignedChar(x);
+    } else if (sizeof(uint64_t) == sizeof(short)) {
+        if (is_unsigned)
+            return (uint64_t)__Pyx_PyInt_AsUnsignedShort(x);
+        else
+            return (uint64_t)__Pyx_PyInt_AsSignedShort(x);
+    } else if (sizeof(uint64_t) == sizeof(int)) {
+        if (is_unsigned)
+            return (uint64_t)__Pyx_PyInt_AsUnsignedInt(x);
+        else
+            return (uint64_t)__Pyx_PyInt_AsSignedInt(x);
+    } else if (sizeof(uint64_t) == sizeof(long)) {
+        if (is_unsigned)
+            return (uint64_t)__Pyx_PyInt_AsUnsignedLong(x);
+        else
+            return (uint64_t)__Pyx_PyInt_AsSignedLong(x);
+    } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) {
+        if (is_unsigned)
+            return (uint64_t)__Pyx_PyInt_AsUnsignedLongLong(x);
+        else
+            return (uint64_t)__Pyx_PyInt_AsSignedLongLong(x);
+    }  else {
+        uint64_t val;
+        PyObject *v = __Pyx_PyNumber_Int(x);
+        #if PY_VERSION_HEX < 0x03000000
+        if (likely(v) && !PyLong_Check(v)) {
+            PyObject *tmp = v;
+            v = PyNumber_Long(tmp);
+            Py_DECREF(tmp);
+        }
+        #endif
+        if (likely(v)) {
+            int one = 1; int is_little = (int)*(unsigned char *)&one;
+            unsigned char *bytes = (unsigned char *)&val;
+            int ret = _PyLong_AsByteArray((PyLongObject *)v,
+                                          bytes, sizeof(val),
+                                          is_little, !is_unsigned);
+            Py_DECREF(v);
+            if (likely(!ret))
+                return val;
+        }
+        return (uint64_t)-1;
+    }
+}
+
 static CYTHON_INLINE uint8_t __Pyx_PyInt_from_py_uint8_t(PyObject* x) {
     const uint8_t neg_one = (uint8_t)-1, const_zero = (uint8_t)0;
     const int is_unsigned = const_zero < neg_one;
@@ -43963,10 +40881,6 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_from_py_uint8_t(PyObject* x) {
         else
             return (uint8_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
         uint8_t val;
         PyObject *v = __Pyx_PyNumber_Int(x);
         #if PY_VERSION_HEX < 0x03000000
@@ -43986,7 +40900,6 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_from_py_uint8_t(PyObject* x) {
             if (likely(!ret))
                 return val;
         }
-        #endif
         return (uint8_t)-1;
     }
 }
@@ -44020,10 +40933,6 @@ 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
@@ -44043,7 +40952,6 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
             if (likely(!ret))
                 return val;
         }
-        #endif
         return (int32_t)-1;
     }
 }
@@ -44475,526 +41383,129 @@ 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;
-#if CYTHON_COMPILING_IN_CPYTHON
     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;
-#else
-    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
-    PyErr_SetExcInfo(*type, *value, *tb);
-#endif
+
     *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 PyTypeObject *__pyx_GeneratorType = 0;
-#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
-#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
-#if 1 || PY_VERSION_HEX < 0x030300B0
-static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
-    PyObject *et, *ev, *tb;
-    PyObject *value = NULL;
-    __Pyx_ErrFetch(&et, &ev, &tb);
-    if (!et) {
-        Py_XDECREF(tb);
-        Py_XDECREF(ev);
-        Py_INCREF(Py_None);
-        *pvalue = Py_None;
-        return 0;
-    }
-    if (unlikely(et != PyExc_StopIteration) &&
-            unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) {
-        __Pyx_ErrRestore(et, ev, tb);
-        return -1;
-    }
-    if (likely(et == PyExc_StopIteration)) {
-        if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) {
-            if (!ev) {
-                Py_INCREF(Py_None);
-                ev = Py_None;
-            }
-            Py_XDECREF(tb);
-            Py_DECREF(et);
-            *pvalue = ev;
-            return 0;
-        }
-    }
-    PyErr_NormalizeException(&et, &ev, &tb);
-    if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) {
-        __Pyx_ErrRestore(et, ev, tb);
-        return -1;
-    }
-    Py_XDECREF(tb);
-    Py_DECREF(et);
-#if PY_VERSION_HEX >= 0x030300A0
-    value = ((PyStopIterationObject *)ev)->value;
-    Py_INCREF(value);
-    Py_DECREF(ev);
-#else
-    {
-        PyObject* args = PyObject_GetAttrString(ev, "args");
-        Py_DECREF(ev);
-        if (likely(args)) {
-            value = PyObject_GetItem(args, 0);
-            Py_DECREF(args);
-        }
-        if (unlikely(!value)) {
-            __Pyx_ErrRestore(NULL, NULL, NULL);
-            Py_INCREF(Py_None);
-            value = Py_None;
-        }
-    }
-#endif
-    *pvalue = value;
-    return 0;
-}
-#endif
-static CYTHON_INLINE
-void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
-    PyObject *exc_type = self->exc_type;
-    PyObject *exc_value = self->exc_value;
-    PyObject *exc_traceback = self->exc_traceback;
+static CYTHON_INLINE void __Pyx_Generator_ExceptionClear(struct __pyx_Generator_object *self)
+{
+    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
-int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) {
-    if (unlikely(gen->is_running)) {
+
+static CYTHON_INLINE PyObject *__Pyx_Generator_SendEx(struct __pyx_Generator_object *self, PyObject *value)
+{
+    PyObject *retval;
+
+    if (self->is_running) {
         PyErr_SetString(PyExc_ValueError,
                         "generator already executing");
-        return 1;
+        return NULL;
     }
-    return 0;
-}
-static CYTHON_INLINE
-PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
-    PyObject *retval;
-    assert(!self->is_running);
-    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) {
-#if CYTHON_COMPILING_IN_PYPY
-#else
-        /* Generators always return to their most recent caller, not
-         * necessarily their creator. */
-        if (self->exc_traceback) {
-            PyThreadState *tstate = PyThreadState_GET();
-            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
-            PyFrameObject *f = tb->tb_frame;
-            Py_XINCREF(tstate->frame);
-            assert(f->f_back == NULL);
-            f->f_back = tstate->frame;
-        }
-#endif
-        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
-                            &self->exc_traceback);
-    } else {
+
+
+    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);
-#if CYTHON_COMPILING_IN_PYPY
-#else
-        /* Don't keep the reference to f_back any longer than necessary.  It
-         * may keep a chain of frames alive or it could create a reference
-         * cycle. */
-        if (self->exc_traceback) {
-            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
-            PyFrameObject *f = tb->tb_frame;
-            Py_CLEAR(f->f_back);
-        }
-#endif
-    } else {
+
+    if (retval)
+        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
+    else
         __Pyx_Generator_ExceptionClear(self);
-    }
+
     return retval;
 }
-static CYTHON_INLINE
-PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) {
-    PyObject *ret;
-    PyObject *val = NULL;
-    __Pyx_Generator_Undelegate(gen);
-    __Pyx_PyGen_FetchStopIterationValue(&val);
-    ret = __Pyx_Generator_SendEx(gen, val);
-    Py_XDECREF(val);
-    return ret;
-}
-static PyObject *__Pyx_Generator_Next(PyObject *self) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
-    PyObject *yf = gen->yieldfrom;
-    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
-        return NULL;
-    if (yf) {
-        PyObject *ret;
-        gen->is_running = 1;
-        ret = Py_TYPE(yf)->tp_iternext(yf);
-        gen->is_running = 0;
-        if (likely(ret)) {
-            return ret;
-        }
-        return __Pyx_Generator_FinishDelegation(gen);
-    }
-    return __Pyx_Generator_SendEx(gen, Py_None);
-}
-static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
-    PyObject *yf = gen->yieldfrom;
-    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
-        return NULL;
-    if (yf) {
-        PyObject *ret;
-        gen->is_running = 1;
-        if (__Pyx_Generator_CheckExact(yf)) {
-            ret = __Pyx_Generator_Send(yf, value);
-        } else {
-            if (value == Py_None)
-                ret = PyIter_Next(yf);
-            else
-                ret = PyObject_CallMethod(yf, (char*)"send", (char*)"O", value);
-        }
-        gen->is_running = 0;
-        if (likely(ret)) {
-            return ret;
-        }
-        return __Pyx_Generator_FinishDelegation(gen);
-    }
-    return __Pyx_Generator_SendEx(gen, value);
+
+static PyObject *__Pyx_Generator_Next(PyObject *self)
+{
+    return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, Py_None);
 }
-static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
-    PyObject *retval = NULL;
-    int err = 0;
-    if (__Pyx_Generator_CheckExact(yf)) {
-        retval = __Pyx_Generator_Close(yf);
-        if (!retval)
-            return -1;
-    } else {
-        PyObject *meth;
-        gen->is_running = 1;
-        meth = PyObject_GetAttrString(yf, "close");
-        if (unlikely(!meth)) {
-            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
-                PyErr_WriteUnraisable(yf);
-            }
-            PyErr_Clear();
-        } else {
-            retval = PyObject_CallFunction(meth, NULL);
-            Py_DECREF(meth);
-            if (!retval)
-                err = -1;
-        }
-        gen->is_running = 0;
-    }
-    Py_XDECREF(retval);
-    return err;
+
+static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value)
+{
+    return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, value);
 }
-static PyObject *__Pyx_Generator_Close(PyObject *self) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
-    PyObject *retval, *raised_exception;
-    PyObject *yf = gen->yieldfrom;
-    int err = 0;
-    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
-        return NULL;
-    if (yf) {
-        Py_INCREF(yf);
-        err = __Pyx_Generator_CloseIter(gen, yf);
-        __Pyx_Generator_Undelegate(gen);
-        Py_DECREF(yf);
-    }
-    if (err == 0)
+
+static PyObject *__Pyx_Generator_Close(PyObject *self)
+{
+    struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self;
+    PyObject *retval;
 #if PY_VERSION_HEX < 0x02050000
-        PyErr_SetNone(PyExc_StopIteration);
+    PyErr_SetNone(PyExc_StopIteration);
 #else
-        PyErr_SetNone(PyExc_GeneratorExit);
+    PyErr_SetNone(PyExc_GeneratorExit);
 #endif
-    retval = __Pyx_Generator_SendEx(gen, NULL);
+    retval = __Pyx_Generator_SendEx(generator, NULL);
     if (retval) {
         Py_DECREF(retval);
         PyErr_SetString(PyExc_RuntimeError,
                         "generator ignored GeneratorExit");
         return NULL;
     }
-    raised_exception = PyErr_Occurred();
-    if (!raised_exception
-        || raised_exception == PyExc_StopIteration
-#if PY_VERSION_HEX >= 0x02050000
-        || raised_exception == PyExc_GeneratorExit
-        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
+#if PY_VERSION_HEX < 0x02050000
+    if (PyErr_ExceptionMatches(PyExc_StopIteration))
+#else
+    if (PyErr_ExceptionMatches(PyExc_StopIteration)
+        || PyErr_ExceptionMatches(PyExc_GeneratorExit))
 #endif
-        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
     {
-        if (raised_exception) PyErr_Clear();      /* ignore these errors */
+        PyErr_Clear();          /* ignore these errors */
         Py_INCREF(Py_None);
         return Py_None;
     }
     return NULL;
 }
-static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
+
+static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args, CYTHON_UNUSED PyObject *kwds)
+{
+    struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self;
     PyObject *typ;
     PyObject *tb = NULL;
     PyObject *val = NULL;
-    PyObject *yf = gen->yieldfrom;
+
     if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
         return NULL;
-    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
-        return NULL;
-    if (yf) {
-        PyObject *ret;
-        Py_INCREF(yf);
-#if PY_VERSION_HEX >= 0x02050000
-        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
-            int err = __Pyx_Generator_CloseIter(gen, yf);
-            Py_DECREF(yf);
-            __Pyx_Generator_Undelegate(gen);
-            if (err < 0)
-                return __Pyx_Generator_SendEx(gen, NULL);
-            goto throw_here;
-        }
-#endif
-        gen->is_running = 1;
-        if (__Pyx_Generator_CheckExact(yf)) {
-            ret = __Pyx_Generator_Throw(yf, args);
-        } else {
-            PyObject *meth = PyObject_GetAttrString(yf, "throw");
-            if (unlikely(!meth)) {
-                Py_DECREF(yf);
-                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
-                    gen->is_running = 0;
-                    return NULL;
-                }
-                PyErr_Clear();
-                __Pyx_Generator_Undelegate(gen);
-                gen->is_running = 0;
-                goto throw_here;
-            }
-            ret = PyObject_CallObject(meth, args);
-            Py_DECREF(meth);
-        }
-        gen->is_running = 0;
-        Py_DECREF(yf);
-        if (!ret) {
-            ret = __Pyx_Generator_FinishDelegation(gen);
-        }
-        return ret;
-    }
-throw_here:
     __Pyx_Raise(typ, val, tb, NULL);
-    return __Pyx_Generator_SendEx(gen, 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->yieldfrom);
-    Py_VISIT(gen->exc_type);
-    Py_VISIT(gen->exc_value);
-    Py_VISIT(gen->exc_traceback);
-    return 0;
-}
-static int __Pyx_Generator_clear(PyObject *self) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
-    Py_CLEAR(gen->closure);
-    Py_CLEAR(gen->classobj);
-    Py_CLEAR(gen->yieldfrom);
-    Py_CLEAR(gen->exc_type);
-    Py_CLEAR(gen->exc_value);
-    Py_CLEAR(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);
-    __Pyx_Generator_clear(self);
-    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;
-    }
-#if CYTHON_COMPILING_FOR_CPYTHON
-    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;
-#endif
-    /* 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
-    --Py_TYPE(self)->tp_frees;
-    --Py_TYPE(self)->tp_allocs;
-#endif
-}
-static PyMemberDef __pyx_Generator_memberlist[] = {
-    {(char *) "gi_running",
-#if PY_VERSION_HEX >= 0x02060000
-     T_BOOL,
-#else
-     T_BYTE,
-#endif
-     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_type = {
-    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*/
-    0,                                  /*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 */
-    0,                                  /*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_type);
-    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->yieldfrom = 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) {
-    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
-    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
-    if (PyType_Ready(&__pyx_GeneratorType_type)) {
-        return -1;
-    }
-    __pyx_GeneratorType = &__pyx_GeneratorType_type;
-    return 0;
+    return __Pyx_Generator_SendEx(generator, NULL);
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename) {
     PyObject *old_exc, *old_val, *old_tb;
     PyObject *ctx;
     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
@@ -45048,23 +41559,6 @@ bad:
     return -1;
 }
 
-#ifndef __PYX_HAVE_RT_ImportModule
-#define __PYX_HAVE_RT_ImportModule
-static PyObject *__Pyx_ImportModule(const char *name) {
-    PyObject *py_name = 0;
-    PyObject *py_module = 0;
-    py_name = __Pyx_PyIdentifier_FromString(name);
-    if (!py_name)
-        goto bad;
-    py_module = PyImport_Import(py_name);
-    Py_DECREF(py_name);
-    return py_module;
-bad:
-    Py_XDECREF(py_name);
-    return 0;
-}
-#endif
-
 #ifndef __PYX_HAVE_RT_ImportType
 #define __PYX_HAVE_RT_ImportType
 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
@@ -45074,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);
@@ -45093,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);
@@ -45103,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);
@@ -45117,105 +41616,51 @@ 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);
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+    PyObject *py_name = 0;
+    PyObject *py_module = 0;
+
+    #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);
+    Py_DECREF(py_name);
+    return py_module;
+bad:
+    Py_XDECREF(py_name);
+    return 0;
 }
+#endif
 
 #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 {
@@ -45226,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,*/
@@ -45272,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);
 }
@@ -45309,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/ctabix.c b/pysam/ctabix.c
index 2a1ce55..5846459 100644
--- a/pysam/ctabix.c
+++ b/pysam/ctabix.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17.4 on Wed Jan 23 22:59:29 2013 */
+/* Generated by Cython 0.16 on Tue Jan 15 06:50:01 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -11,6 +11,7 @@
 #ifndef offsetof
 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
 #endif
+
 #if !defined(WIN32) && !defined(MS_WINDOWS)
   #ifndef __stdcall
     #define __stdcall
@@ -22,18 +23,22 @@
     #define __fastcall
   #endif
 #endif
+
 #ifndef DL_IMPORT
   #define DL_IMPORT(t) t
 #endif
 #ifndef DL_EXPORT
   #define DL_EXPORT(t) t
 #endif
+
 #ifndef PY_LONG_LONG
   #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
@@ -41,28 +46,28 @@
 #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
+#endif
+
 #if PY_VERSION_HEX < 0x02050000
   typedef int Py_ssize_t;
   #define PY_SSIZE_T_MAX INT_MAX
   #define PY_SSIZE_T_MIN INT_MIN
   #define PY_FORMAT_SIZE_T ""
-  #define CYTHON_FORMAT_SSIZE_T ""
   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
   #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
-  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
-                                (PyErr_Format(PyExc_TypeError, \
-                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
-                                 (PyObject*)0))
-  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
-                                  !PyComplex_Check(o))
-  #define PyIndex_Check __Pyx_PyIndex_Check
+  #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"
-  #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)
   #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
@@ -70,6 +75,7 @@
   #define PyVarObject_HEAD_INIT(type, size) \
           PyObject_HEAD_INIT(type) size,
   #define PyType_Modified(t)
+
   typedef struct {
      void *buf;
      PyObject *obj;
@@ -83,6 +89,7 @@
      Py_ssize_t *suboffsets;
      void *internal;
   } Py_buffer;
+
   #define PyBUF_SIMPLE 0
   #define PyBUF_WRITABLE 0x0001
   #define PyBUF_FORMAT 0x0004
@@ -94,9 +101,11 @@
   #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) \
@@ -106,30 +115,31 @@
   #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
   #define Py_TPFLAGS_CHECKTYPES 0
   #define Py_TPFLAGS_HAVE_INDEX 0
 #endif
+
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
-#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+
+
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
   #define CYTHON_PEP393_ENABLED 1
-  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
-                                              0 : _PyUnicode_Ready((PyObject *)(op)))
-  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
+  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
-  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
 #else
   #define CYTHON_PEP393_ENABLED 0
-  #define __Pyx_PyUnicode_READY(op)       (0)
-  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
+  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
-  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
 #endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyBaseString_Type            PyUnicode_Type
   #define PyStringObject               PyUnicodeObject
@@ -137,6 +147,7 @@
   #define PyString_Check               PyUnicode_Check
   #define PyString_CheckExact          PyUnicode_CheckExact
 #endif
+
 #if PY_VERSION_HEX < 0x02060000
   #define PyBytesObject                PyStringObject
   #define PyBytes_Type                 PyString_Type
@@ -155,6 +166,7 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -162,7 +174,9 @@
 #ifndef PySet_CheckExact
   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
+
 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
 #if PY_MAJOR_VERSION >= 3
   #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
@@ -179,9 +193,11 @@
   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 #endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyBoolObject                 PyLongObject
 #endif
+
 #if PY_VERSION_HEX < 0x03020000
   typedef long Py_hash_t;
   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
@@ -190,6 +206,7 @@
   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
 #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)
@@ -208,9 +225,11 @@
         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
             (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
 #endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
+
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
@@ -220,6 +239,7 @@
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
 #endif
+
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_NAMESTR(n) ((char *)(n))
   #define __Pyx_DOCSTR(n)  ((char *)(n))
@@ -228,7 +248,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)
@@ -317,11 +336,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
-#if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
-#else
-#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
-#endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
 
 #ifdef __GNUC__
@@ -351,7 +366,6 @@ static const char *__pyx_filename;
 static const char *__pyx_f[] = {
   "ctabix.pyx",
   "TabProxies.pxd",
-  "type.pxd",
   "bool.pxd",
   "complex.pxd",
 };
@@ -758,11 +772,6 @@ static struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy *__pyx_vtabptr_5pysa
 
 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
-static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
-         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
-         const char* encoding, const char* errors,
-         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
-
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
@@ -790,47 +799,42 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j
                                                     __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 CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+            PyObject *r = PyList_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
 }
 #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 CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
 }
 #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 CYTHON_COMPILING_IN_CPYTHON
     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)))) {
@@ -846,39 +850,34 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i)
             Py_INCREF(r);
             return r;
         }
-    } else {  /* inlined PySequence_GetItem() */
+    }
+    else if (likely(i >= 0)) {
         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
         if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
             return m->sq_item(o, i);
         }
     }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
-
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
 
-static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
+static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
+
 #if PY_MAJOR_VERSION >= 3
 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     PyObject *value;
+    if (unlikely(d == Py_None)) {
+        __Pyx_RaiseNoneIndexingError();
+        return NULL;
+    }
     value = PyDict_GetItemWithError(d, key);
     if (unlikely(!value)) {
         if (!PyErr_Occurred())
@@ -946,6 +945,16 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                             PyObject *tuple);
 static int __Pyx_CyFunction_init(void);
 
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
+
 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
 
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
@@ -992,10 +1001,10 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
 #endif
 #endif
 
-static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
-
 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*/
+
 static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
 
 typedef struct {
@@ -1051,10 +1060,7 @@ static PyTypeObject *__pyx_ptype_5pysam_10TabProxies_VCFProxy = 0;
 
 /* Module declarations from 'cpython.iterator' */
 
-/* Module declarations from '__builtin__' */
-
 /* Module declarations from 'cpython.type' */
-static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
 
 /* Module declarations from 'cpython.number' */
 
@@ -1213,7 +1219,7 @@ 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[] = "/ifs/devel/pysam/pysam/ctabix.pyx";
+static char __pyx_k_65[] = "/home/andreas/devel/pysam/pysam/ctabix.pyx";
 static char __pyx_k_66[] = "pysam.ctabix";
 static char __pyx_k_77[] = "iterate over ``infile``.\n    \n    Permits the use of file-like objects for example from the gzip module.\n    ";
 static char __pyx_k_80[] = "tabix_inplace_iterator";
@@ -1537,7 +1543,7 @@ static PyObject *__pyx_f_5pysam_6ctabix_from_string_and_size(char *__pyx_v_s, si
  *         return s[:length].decode("ascii")
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = PyBytes_FromStringAndSize(((const char*)__pyx_v_s) + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -1554,7 +1560,7 @@ static PyObject *__pyx_f_5pysam_6ctabix_from_string_and_size(char *__pyx_v_s, si
  * # filename encoding (copied from lxml.etree.pyx)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_length, NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = ((PyObject *)PyUnicode_DecodeASCII(__pyx_v_s, __pyx_v_length, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -1951,7 +1957,7 @@ static PyObject *__pyx_f_5pysam_6ctabix__charptr_to_str(char *__pyx_v_s) {
  * cdef _force_str(object s):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = ((PyObject *)PyUnicode_DecodeASCII(__pyx_v_s, strlen(__pyx_v_s), NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __pyx_r = ((PyObject *)__pyx_t_2);
     __pyx_t_2 = 0;
@@ -2103,6 +2109,7 @@ static int __pyx_pw_5pysam_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self,
   PyObject *__pyx_v_mode = 0;
   PyObject *__pyx_v_args = 0;
   PyObject *__pyx_v_kwargs = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -2120,7 +2127,6 @@ static int __pyx_pw_5pysam_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self,
     __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
   }
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
     PyObject* values[2] = {0,0};
     values[1] = ((PyObject *)__pyx_n_s__r);
     if (unlikely(__pyx_kwds)) {
@@ -2135,7 +2141,8 @@ static int __pyx_pw_5pysam_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -2313,11 +2320,11 @@ static char __pyx_doc_5pysam_6ctabix_9Tabixfile_4_open[] = "Tabixfile._open(self
 static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_v_mode = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_open (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
     PyObject* values[2] = {0,0};
     values[1] = ((PyObject *)__pyx_n_s__r);
     if (unlikely(__pyx_kwds)) {
@@ -2332,7 +2339,8 @@ static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_sel
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -2381,8 +2389,8 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   int __pyx_t_5;
   char *__pyx_t_6;
@@ -2404,11 +2412,9 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
   #ifndef CYTHON_WITHOUT_ASSERTIONS
   __Pyx_INCREF(__pyx_v_mode);
   __pyx_t_1 = __pyx_v_mode;
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!((int)__pyx_t_3))) {
+  if (unlikely(!((int)__pyx_t_2))) {
     __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
     PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
@@ -2424,14 +2430,14 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  *         self.tabixfile = NULL
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->tabixfile != NULL);
-  if (__pyx_t_3) {
+  __pyx_t_2 = (__pyx_v_self->tabixfile != NULL);
+  if (__pyx_t_2) {
     __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 = 108; __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -2452,10 +2458,10 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  *         self.isremote = filename.startswith( "http:") or filename.startswith( "ftp:" )
  * 
  */
-  __pyx_t_2 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_v_filename_index = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_t_3 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_filename_index = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "pysam/ctabix.pyx":112
  * 
@@ -2464,27 +2470,27 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  * 
  *         # encode all the strings
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (!__pyx_t_3) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!__pyx_t_2) {
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = __pyx_t_4;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = __pyx_t_4;
     __pyx_t_4 = 0;
   } else {
-    __pyx_t_2 = __pyx_t_1;
+    __pyx_t_3 = __pyx_t_1;
     __pyx_t_1 = 0;
   }
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_v_self->isremote = __pyx_t_5;
 
   /* "pysam/ctabix.pyx":115
@@ -2494,11 +2500,11 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  *         filename_index = _my_encodeFilename(filename_index)
  *         cdef bytes bmode = mode.encode('ascii')
  */
-  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_v_filename);
-  __pyx_v_filename = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_v_filename = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "pysam/ctabix.pyx":116
  *         # encode all the strings
@@ -2507,11 +2513,11 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  *         cdef bytes bmode = mode.encode('ascii')
  * 
  */
-  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_6ctabix__my_encodeFilename(__pyx_v_filename_index)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_6ctabix__my_encodeFilename(__pyx_v_filename_index)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_v_filename_index);
-  __pyx_v_filename_index = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_v_filename_index = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "pysam/ctabix.pyx":117
  *         filename = _my_encodeFilename(filename)
@@ -2520,11 +2526,11 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  * 
  *         if self._filename != NULL: free(self._filename )
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_mode, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_mode, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_bmode = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -2536,8 +2542,8 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  * 
  *         self._filename = strdup(filename)
  */
-  __pyx_t_3 = (__pyx_v_self->_filename != NULL);
-  if (__pyx_t_3) {
+  __pyx_t_2 = (__pyx_v_self->_filename != NULL);
+  if (__pyx_t_2) {
     free(__pyx_v_self->_filename);
     goto __pyx_L4;
   }
@@ -2562,11 +2568,9 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  */
   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (__pyx_t_3) {
+  if (__pyx_t_2) {
 
     /* "pysam/ctabix.pyx":125
  *         if mode[0] == 'w':
@@ -2575,10 +2579,10 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  * 
  *         elif mode[0] == "r":
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __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_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
@@ -2590,13 +2594,11 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  *             # open file for reading
  * 
  */
-  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_3) {
+  if (__pyx_t_2) {
 
     /* "pysam/ctabix.pyx":130
  *             # open file for reading
@@ -2605,8 +2607,8 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  *                 if not os.path.exists( filename ):
  *                     raise IOError( "file `%s` not found" % filename)
  */
-    __pyx_t_3 = (!__pyx_v_self->isremote);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (!__pyx_v_self->isremote);
+    if (__pyx_t_2) {
 
       /* "pysam/ctabix.pyx":131
  * 
@@ -2617,24 +2619,24 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  */
       __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __Pyx_INCREF(__pyx_v_filename);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename);
       __Pyx_GIVEREF(__pyx_v_filename);
-      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_7 = (!__pyx_t_3);
+      __pyx_t_7 = (!__pyx_t_2);
       if (__pyx_t_7) {
 
         /* "pysam/ctabix.pyx":132
@@ -2646,14 +2648,14 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  */
         __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_filename); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
         __pyx_t_4 = 0;
-        __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2670,25 +2672,25 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  */
       __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __Pyx_INCREF(__pyx_v_filename_index);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename_index);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename_index);
       __Pyx_GIVEREF(__pyx_v_filename_index);
-      __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
       __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_3 = (!__pyx_t_7);
-      if (__pyx_t_3) {
+      __pyx_t_2 = (!__pyx_t_7);
+      if (__pyx_t_2) {
 
         /* "pysam/ctabix.pyx":135
  * 
@@ -2699,14 +2701,14 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  */
         __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_v_filename_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
         __pyx_t_1 = 0;
-        __pyx_t_1 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2738,8 +2740,8 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  *             raise IOError("could not open file `%s`" % filename )
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->tabixfile == NULL);
-  if (__pyx_t_3) {
+  __pyx_t_2 = (__pyx_v_self->tabixfile == NULL);
+  if (__pyx_t_2) {
 
     /* "pysam/ctabix.pyx":141
  * 
@@ -2750,14 +2752,14 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
  */
     __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), __pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
     __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2769,7 +2771,7 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_4_open(struct __pyx_obj_5pys
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("pysam.ctabix.Tabixfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
@@ -2790,11 +2792,11 @@ static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_7_parseRegion(PyObject *__py
   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;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_parseRegion (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
     PyObject* values[4] = {0,0,0,0};
 
     /* "pysam/ctabix.pyx":144
@@ -2972,11 +2974,13 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_o
  *                 region = "%s:%i-%i" % (reference, start+1, end)
  *             elif start == None and end != None:
  */
-    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_1) {
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_4 = __pyx_t_3;
@@ -3021,11 +3025,13 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_o
  *                 region = "%s:%i-%i" % (reference, 1, end)
  *             elif end == None and start != None:
  */
-    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_4) {
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_3 = __pyx_t_1;
@@ -3068,11 +3074,13 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_o
  *                 region = "%s:%i-%i" % (reference, start+1, max_pos-1)
  *             else:
  */
-    __pyx_t_5 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (__pyx_t_3) {
-      __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __pyx_t_1 = __pyx_t_4;
@@ -3361,11 +3369,11 @@ static PyObject *__pyx_pw_5pysam_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_sel
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_region = 0;
   PyObject *__pyx_v_parser = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__parser,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__parser,0};
     PyObject* values[5] = {0,0,0,0,0};
 
     /* "pysam/ctabix.pyx":191
@@ -3585,23 +3593,22 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_5pys
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
     PyObject* sequence = __pyx_t_5;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    Py_ssize_t size = Py_SIZE(sequence);
-    #else
-    Py_ssize_t size = PySequence_Size(sequence);
-    #endif
-    if (unlikely(size != 4)) {
-      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
-      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
+      if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
+        if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
+        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
       __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
     } else {
+      if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
+        if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
+        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
       __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
@@ -3611,36 +3618,28 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_5pys
     __Pyx_INCREF(__pyx_t_2);
     __Pyx_INCREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_t_7);
-    #else
-    Py_ssize_t i;
-    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
-    for (i=0; i < 4; i++) {
-      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      *(temps[i]) = item;
-    }
-    #endif
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  } else
-  {
+  } else {
     Py_ssize_t index = -1;
-    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
     __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-    for (index=0; index < 4; index++) {
-      PyObject* item = __pyx_t_9(__pyx_t_8); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
-      __Pyx_GOTREF(item);
-      *(temps[index]) = item;
-    }
+    index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L4_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;
+    __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;
+    __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;
+    __Pyx_GOTREF(__pyx_t_7);
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_9 = NULL;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_9 = NULL;
-    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
@@ -3661,7 +3660,8 @@ static PyObject *__pyx_pf_5pysam_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_5pys
  *             if region:
  *                 return TabixIterator( self, rtid, rstart, rend )
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_parser, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_RichCompare(__pyx_v_parser, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   if (__pyx_t_4) {
@@ -4241,11 +4241,11 @@ static int __pyx_pw_5pysam_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_
   int __pyx_v_tid;
   int __pyx_v_start;
   int __pyx_v_end;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0};
     PyObject* values[4] = {0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -4261,20 +4261,24 @@ static int __pyx_pw_5pysam_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
+        if (likely(values[3])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -4327,7 +4331,6 @@ static int __pyx_pf_5pysam_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_5p
   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;
@@ -4361,8 +4364,7 @@ static int __pyx_pf_5pysam_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_5p
  * 
  *         if tid < 0:
  */
-  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
-  __pyx_v_self->tabixfile = __pyx_t_4;
+  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
 
   /* "pysam/ctabix.pyx":293
  *         self.tabixfile = tabixfile.tabixfile
@@ -4490,9 +4492,7 @@ static PyObject *__pyx_pf_5pysam_6ctabix_13TabixIterator_2__iter__(struct __pyx_
 /* Python wrapper */
 static PyObject *__pyx_pw_5pysam_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
 static char __pyx_doc_5pysam_6ctabix_13TabixIterator_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
 struct wrapperbase __pyx_wrapperbase_5pysam_6ctabix_13TabixIterator_4__next__;
-#endif
 static PyObject *__pyx_pw_5pysam_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
@@ -4661,11 +4661,11 @@ static void __pyx_pf_5pysam_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_ob
 static int __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   struct __pyx_obj_5pysam_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -4678,7 +4678,8 @@ static int __pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
@@ -4723,7 +4724,6 @@ static int __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_
   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;
@@ -4757,8 +4757,7 @@ static int __pyx_pf_5pysam_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_
  * 
  *         self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
  */
-  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
-  __pyx_v_self->tabixfile = __pyx_t_4;
+  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
 
   /* "pysam/ctabix.pyx":344
  *         self.tabixfile = tabixfile.tabixfile
@@ -4853,9 +4852,7 @@ static PyObject *__pyx_pf_5pysam_6ctabix_19TabixHeaderIterator_2__iter__(struct
 /* Python wrapper */
 static PyObject *__pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
 static char __pyx_doc_5pysam_6ctabix_19TabixHeaderIterator_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
 struct wrapperbase __pyx_wrapperbase_5pysam_6ctabix_19TabixHeaderIterator_4__next__;
-#endif
 static PyObject *__pyx_pw_5pysam_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
@@ -5002,11 +4999,11 @@ static PyObject *__pyx_pw_5pysam_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_se
 static PyObject *__pyx_pw_5pysam_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5020,10 +5017,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_se
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5124,11 +5123,11 @@ static PyObject *__pyx_pw_5pysam_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self
 static PyObject *__pyx_pw_5pysam_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5142,10 +5141,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5246,11 +5247,11 @@ static PyObject *__pyx_pw_5pysam_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self
 static PyObject *__pyx_pw_5pysam_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5264,10 +5265,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5368,11 +5371,11 @@ static PyObject *__pyx_pw_5pysam_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self
 static PyObject *__pyx_pw_5pysam_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5386,10 +5389,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5493,11 +5498,11 @@ static int __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__
   int __pyx_v_start;
   int __pyx_v_end;
   struct __pyx_obj_5pysam_6ctabix_Parser *__pyx_v_parser = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__parser,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__parser,0};
     PyObject* values[5] = {0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5514,25 +5519,30 @@ static int __pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
+        if (likely(values[3])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  4:
-        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
+        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
+        if (likely(values[4])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5588,7 +5598,6 @@ static int __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_
   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;
@@ -5635,8 +5644,7 @@ static int __pyx_pf_5pysam_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_
  * 
  *         if tid < 0:
  */
-  __pyx_t_4 = __pyx_v_tabixfile->tabixfile;
-  __pyx_v_self->tabixfile = __pyx_t_4;
+  __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
 
   /* "pysam/ctabix.pyx":530
  *         self.tabixfile = tabixfile.tabixfile
@@ -5764,9 +5772,7 @@ static PyObject *__pyx_pf_5pysam_6ctabix_19TabixIteratorParsed_2__iter__(struct
 /* Python wrapper */
 static PyObject *__pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__pyx_v_self); /*proto*/
 static char __pyx_doc_5pysam_6ctabix_19TabixIteratorParsed_4__next__[] = "python version of next().\n\n        pyrex uses this non-standard name instead of next()\n        ";
-#if CYTHON_COMPILING_IN_CPYTHON
 struct wrapperbase __pyx_wrapperbase_5pysam_6ctabix_19TabixIteratorParsed_4__next__;
-#endif
 static PyObject *__pyx_pw_5pysam_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
@@ -5944,11 +5950,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_1tabix_compress(PyObject *__pyx_self, P
   PyObject *__pyx_v_filename_in = 0;
   PyObject *__pyx_v_filename_out = 0;
   PyObject *__pyx_v_force = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename_in,&__pyx_n_s__filename_out,&__pyx_n_s__force,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("tabix_compress (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename_in,&__pyx_n_s__filename_out,&__pyx_n_s__force,0};
     PyObject* values[3] = {0,0,0};
     values[2] = __pyx_k_30;
     if (unlikely(__pyx_kwds)) {
@@ -5964,10 +5971,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_1tabix_compress(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_in)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_in);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_out)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_out);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -6366,11 +6375,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_3tabix_index(PyObject *__pyx_self, PyOb
   PyObject *__pyx_v_preset = 0;
   PyObject *__pyx_v_meta_char = 0;
   PyObject *__pyx_v_zerobased = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__force,&__pyx_n_s__seq_col,&__pyx_n_s__start_col,&__pyx_n_s__end_col,&__pyx_n_s__preset,&__pyx_n_s__meta_char,&__pyx_n_s__zerobased,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("tabix_index (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__force,&__pyx_n_s__seq_col,&__pyx_n_s__start_col,&__pyx_n_s__end_col,&__pyx_n_s__preset,&__pyx_n_s__meta_char,&__pyx_n_s__zerobased,0};
     PyObject* values[8] = {0,0,0,0,0,0,0,0};
     values[1] = __pyx_k_39;
 
@@ -6429,7 +6439,8 @@ static PyObject *__pyx_pw_5pysam_6ctabix_3tabix_index(PyObject *__pyx_self, PyOb
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -6605,19 +6616,23 @@ static PyObject *__pyx_pf_5pysam_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__
  *         raise ValueError("neither preset nor seq_col,start_col and end_col given" )
  * 
  */
-  __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_3 = PyObject_RichCompare(__pyx_v_preset, Py_None, Py_EQ); 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_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;
   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_3 = PyObject_RichCompare(__pyx_v_seq_col, Py_None, Py_EQ); 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_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_3 = PyObject_RichCompare(__pyx_v_start_col, Py_None, Py_EQ); 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_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_3 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); 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_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;
@@ -7112,7 +7127,8 @@ static PyObject *__pyx_pf_5pysam_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__
  *         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 = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __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_6) {
@@ -7207,18 +7223,12 @@ static PyObject *__pyx_pf_5pysam_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__
  */
   if ((likely(PyTuple_CheckExact(__pyx_v_conf_data))) || (PyList_CheckExact(__pyx_v_conf_data))) {
     PyObject* sequence = __pyx_v_conf_data;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    Py_ssize_t size = Py_SIZE(sequence);
-    #else
-    Py_ssize_t size = PySequence_Size(sequence);
-    #endif
-    if (unlikely(size != 6)) {
-      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
-      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-      {__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))) {
+      if (unlikely(PyTuple_GET_SIZE(sequence) != 6)) {
+        if (PyTuple_GET_SIZE(sequence) > 6) __Pyx_RaiseTooManyValuesError(6);
+        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
       __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
@@ -7226,6 +7236,11 @@ static PyObject *__pyx_pf_5pysam_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 4); 
       __pyx_t_2 = PyTuple_GET_ITEM(sequence, 5); 
     } else {
+      if (unlikely(PyList_GET_SIZE(sequence) != 6)) {
+        if (PyList_GET_SIZE(sequence) > 6) __Pyx_RaiseTooManyValuesError(6);
+        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
       __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
@@ -7239,34 +7254,30 @@ static PyObject *__pyx_pf_5pysam_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__
     __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_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 = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      *(temps[i]) = item;
-    }
-    #endif
-  } else
-  {
+  } else {
     Py_ssize_t index = -1;
-    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_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L20_unpacking_failed;
-      __Pyx_GOTREF(item);
-      *(temps[index]) = item;
-    }
+    index = 0; __pyx_t_14 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_14)) goto __pyx_L20_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_14);
+    index = 1; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L20_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_15);
+    index = 2; __pyx_t_9 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_9)) goto __pyx_L20_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_9);
+    index = 3; __pyx_t_3 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_3)) goto __pyx_L20_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_3);
+    index = 4; __pyx_t_1 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_1)) goto __pyx_L20_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_1);
+    index = 5; __pyx_t_2 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_2)) goto __pyx_L20_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_2);
     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);
+    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L21_unpacking_done:;
   }
@@ -7352,11 +7363,11 @@ static int __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject
 static int __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_infile = 0;
   int __pyx_v_buffer_size;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__buffer_size,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__buffer_size,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -7370,7 +7381,8 @@ static int __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -7381,6 +7393,10 @@ static int __pyx_pw_5pysam_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject
       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 = 719; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
+      if (values[1]) {
+      } else {
+        __pyx_v_buffer_size = ((int)65536);
+      }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
@@ -7571,15 +7587,14 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
   char *__pyx_v_result;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  char *__pyx_t_1;
+  PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   int __pyx_t_4;
   int __pyx_t_5;
   int __pyx_t_6;
-  int __pyx_t_7;
+  PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
-  PyObject *__pyx_t_9 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -7592,8 +7607,7 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  *         r = self.Parser()
  * 
  */
-  __pyx_t_1 = __pyx_v_self->buffer;
-  __pyx_v_b = __pyx_t_1;
+  __pyx_v_b = __pyx_v_self->buffer;
 
   /* "pysam/ctabix.pyx":738
  *         cdef size_t nbytes
@@ -7602,13 +7616,13 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  * 
  *         while not feof( self.infile ):
  */
-  __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_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__Parser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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 = 738; __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 = 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;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_r = __pyx_t_2;
+  __pyx_t_2 = 0;
 
   /* "pysam/ctabix.pyx":740
  *         r = self.Parser()
@@ -7618,8 +7632,8 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  * 
  */
   while (1) {
-    __pyx_t_4 = (!feof(__pyx_v_self->infile));
-    if (!__pyx_t_4) break;
+    __pyx_t_3 = (!feof(__pyx_v_self->infile));
+    if (!__pyx_t_3) break;
 
     /* "pysam/ctabix.pyx":741
  * 
@@ -7637,8 +7651,8 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  *             # skip comments
  *             if (b[0] == '#'): continue
  */
-    __pyx_t_4 = (__pyx_v_nbytes == -1);
-    if (__pyx_t_4) {
+    __pyx_t_3 = (__pyx_v_nbytes == -1);
+    if (__pyx_t_3) {
       goto __pyx_L4_break;
       goto __pyx_L5;
     }
@@ -7651,8 +7665,8 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  * 
  *             # skip empty lines
  */
-    __pyx_t_4 = ((__pyx_v_b[0]) == '#');
-    if (__pyx_t_4) {
+    __pyx_t_3 = ((__pyx_v_b[0]) == '#');
+    if (__pyx_t_3) {
       goto __pyx_L3_continue;
       goto __pyx_L6;
     }
@@ -7665,20 +7679,20 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  * 
  *             # make sure that entry is complete
  */
-    __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;
+    __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;
       } else {
-        __pyx_t_7 = __pyx_t_5;
+        __pyx_t_6 = __pyx_t_4;
       }
-      __pyx_t_5 = __pyx_t_7;
+      __pyx_t_4 = __pyx_t_6;
     } else {
-      __pyx_t_5 = __pyx_t_4;
+      __pyx_t_4 = __pyx_t_3;
     }
-    if (__pyx_t_5) {
+    if (__pyx_t_4) {
       goto __pyx_L3_continue;
       goto __pyx_L7;
     }
@@ -7691,14 +7705,14 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  *                 result = b
  *                 raise ValueError( "incomplete line at %s" % result )
  */
-    __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;
+    __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;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_6 = __pyx_t_4;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_6) {
 
       /* "pysam/ctabix.pyx":753
  *             # make sure that entry is complete
@@ -7716,21 +7730,21 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  * 
  *             # make sure that this goes fully through C
  */
-      __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_t_2 = PyBytes_FromString(__pyx_v_result); 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_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_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __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 = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __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;
+      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 = 754; __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 = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
@@ -7743,25 +7757,25 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
  *             return r
  * 
  */
-    __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);
-    __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_t_1 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__present); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __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 = 760; __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 = 760; __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 = 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;
+    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 = 760; __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;
 
     /* "pysam/ctabix.pyx":761
  *             # the wrong memory is freed
@@ -7791,10 +7805,10 @@ static PyObject *__pyx_f_5pysam_6ctabix_22tabix_inplace_iterator___cnext__(struc
   __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_3);
+  __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("pysam.ctabix.tabix_inplace_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -7896,11 +7910,11 @@ static int __pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__
 static int __pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_infile = 0;
   struct __pyx_obj_5pysam_6ctabix_Parser *__pyx_v_parser = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -7914,10 +7928,12 @@ static int __pyx_pw_5pysam_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -8389,11 +8405,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_1__init__(PyOb
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_infile = 0;
   PyObject *__pyx_v_parser = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__infile,&__pyx_n_s__parser,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__infile,&__pyx_n_s__parser,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -8408,15 +8425,18 @@ static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_1__init__(PyOb
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile);
+        if (likely(values[1])) kw_args--;
         else {
           __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--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -8530,6 +8550,7 @@ static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_3__iter__(PyOb
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_2__iter__(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -8575,6 +8596,7 @@ static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_5__next__(PyOb
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_4__next__(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -8882,6 +8904,7 @@ static PyObject *__pyx_pw_5pysam_6ctabix_22tabix_generic_iterator_7next(PyObject
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("next (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_6ctabix_22tabix_generic_iterator_6next(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -8942,11 +8965,12 @@ static PyMethodDef __pyx_mdef_5pysam_6ctabix_5tabix_iterator = {__Pyx_NAMESTR("t
 static PyObject *__pyx_pw_5pysam_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_infile = 0;
   PyObject *__pyx_v_parser = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("tabix_iterator (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -8960,10 +8984,12 @@ static PyObject *__pyx_pw_5pysam_6ctabix_5tabix_iterator(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -9074,15 +9100,15 @@ static void __pyx_tp_dealloc_5pysam_6ctabix_Tabixfile(PyObject *o) {
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_filename(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_filename(PyObject *o, void *x) {
   return __pyx_pw_5pysam_6ctabix_9Tabixfile_8filename_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_header(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_header(PyObject *o, void *x) {
   return __pyx_pw_5pysam_6ctabix_9Tabixfile_6header_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_contigs(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_6ctabix_9Tabixfile_contigs(PyObject *o, void *x) {
   return __pyx_pw_5pysam_6ctabix_9Tabixfile_7contigs_1__get__(o);
 }
 
@@ -9618,7 +9644,7 @@ static PyTypeObject __pyx_type_5pysam_6ctabix_TabixHeaderIterator = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_6ctabix_Parser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_5pysam_6ctabix_Parser(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
   return o;
@@ -10456,7 +10482,6 @@ static PyObject *__pyx_tp_new_5pysam_6ctabix_TabixIteratorParsed(PyTypeObject *t
 
 static void __pyx_tp_dealloc_5pysam_6ctabix_TabixIteratorParsed(PyObject *o) {
   struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_5pysam_6ctabix_TabixIteratorParsed *)o;
-  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -10466,8 +10491,7 @@ static void __pyx_tp_dealloc_5pysam_6ctabix_TabixIteratorParsed(PyObject *o) {
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->parser);
-  PyObject_GC_Track(o);
+  Py_XDECREF(((PyObject *)p->parser));
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -10664,7 +10688,6 @@ static PyObject *__pyx_tp_new_5pysam_6ctabix_tabix_inplace_iterator(PyTypeObject
 
 static void __pyx_tp_dealloc_5pysam_6ctabix_tabix_inplace_iterator(PyObject *o) {
   struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_5pysam_6ctabix_tabix_inplace_iterator *)o;
-  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -10674,8 +10697,7 @@ static void __pyx_tp_dealloc_5pysam_6ctabix_tabix_inplace_iterator(PyObject *o)
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->parser);
-  PyObject_GC_Track(o);
+  Py_XDECREF(((PyObject *)p->parser));
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -10872,9 +10894,7 @@ static PyObject *__pyx_tp_new_5pysam_6ctabix_tabix_copy_iterator(PyTypeObject *t
 
 static void __pyx_tp_dealloc_5pysam_6ctabix_tabix_copy_iterator(PyObject *o) {
   struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_5pysam_6ctabix_tabix_copy_iterator *)o;
-  PyObject_GC_UnTrack(o);
-  Py_CLEAR(p->parser);
-  PyObject_GC_Track(o);
+  Py_XDECREF(((PyObject *)p->parser));
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -11803,23 +11823,16 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   #endif
   /*--- Module creation code ---*/
   #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
   #else
   __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, "pysam.ctabix")) {
-      if (unlikely(PyDict_SetItemString(modules, "pysam.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);
+  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  #if PY_MAJOR_VERSION < 3
+  Py_INCREF(__pyx_m);
   #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
+  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -11839,7 +11852,6 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   if (__Pyx_SetAttrString(__pyx_m, "Tabixfile", (PyObject *)&__pyx_type_5pysam_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5pysam_6ctabix_Tabixfile = &__pyx_type_5pysam_6ctabix_Tabixfile;
   if (PyType_Ready(&__pyx_type_5pysam_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_6ctabix_TabixIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
@@ -11848,11 +11860,9 @@ PyMODINIT_FUNC PyInit_ctabix(void)
       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_6ctabix_13TabixIterator_4__next__;
     }
   }
-  #endif
   if (__Pyx_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_5pysam_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5pysam_6ctabix_TabixIterator = &__pyx_type_5pysam_6ctabix_TabixIterator;
   if (PyType_Ready(&__pyx_type_5pysam_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_6ctabix_TabixHeaderIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
@@ -11861,7 +11871,6 @@ PyMODINIT_FUNC PyInit_ctabix(void)
       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_6ctabix_19TabixHeaderIterator_4__next__;
     }
   }
-  #endif
   if (__Pyx_SetAttrString(__pyx_m, "TabixHeaderIterator", (PyObject *)&__pyx_type_5pysam_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5pysam_6ctabix_TabixHeaderIterator = &__pyx_type_5pysam_6ctabix_TabixHeaderIterator;
   if (PyType_Ready(&__pyx_type_5pysam_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -11884,7 +11893,6 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   if (__Pyx_SetAttrString(__pyx_m, "asVCF", (PyObject *)&__pyx_type_5pysam_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5pysam_6ctabix_asVCF = &__pyx_type_5pysam_6ctabix_asVCF;
   if (PyType_Ready(&__pyx_type_5pysam_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  #if CYTHON_COMPILING_IN_CPYTHON
   {
     PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5pysam_6ctabix_TabixIteratorParsed, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
@@ -11893,7 +11901,6 @@ PyMODINIT_FUNC PyInit_ctabix(void)
       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_6ctabix_19TabixIteratorParsed_4__next__;
     }
   }
-  #endif
   if (__Pyx_SetAttrString(__pyx_m, "TabixIteratorParsed", (PyObject *)&__pyx_type_5pysam_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5pysam_6ctabix_TabixIteratorParsed = &__pyx_type_5pysam_6ctabix_TabixIteratorParsed;
   __pyx_vtabptr_5pysam_6ctabix_tabix_inplace_iterator = &__pyx_vtable_5pysam_6ctabix_tabix_inplace_iterator;
@@ -11919,15 +11926,8 @@ PyMODINIT_FUNC PyInit_ctabix(void)
   __pyx_vtabptr_5pysam_10TabProxies_BedProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5pysam_10TabProxies_VCFProxy = __Pyx_ImportType("pysam.TabProxies", "VCFProxy", sizeof(struct __pyx_obj_5pysam_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_5pysam_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_vtabptr_5pysam_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_5pysam_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_5pysam_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_5pysam_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
-  #if CYTHON_COMPILING_IN_PYPY
-  sizeof(PyTypeObject),
-  #else
-  sizeof(PyHeapTypeObject),
-  #endif
-  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   /*--- Execution code ---*/
@@ -12325,32 +12325,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     return result;
 }
 
-static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
-         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
-         const char* encoding, const char* errors,
-         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
-    Py_ssize_t length;
-    if (unlikely((start < 0) | (stop < 0))) {
-        length = strlen(cstring);
-        if (start < 0) {
-            start += length;
-            if (start < 0)
-                start = 0;
-        }
-        if (stop < 0)
-            stop += length;
-    }
-    length = stop - start;
-    if (unlikely(length <= 0))
-        return PyUnicode_FromUnicode(NULL, 0);
-    cstring += start;
-    if (decode_func) {
-        return decode_func(cstring, length, errors);
-    } else {
-        return PyUnicode_Decode(cstring, length, encoding, errors);
-    }
-}
-
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
 #if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
@@ -12386,38 +12360,33 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                         CYTHON_UNUSED PyObject *cause) {
     Py_XINCREF(type);
-    if (!value || value == Py_None)
-        value = NULL;
-    else
+    Py_XINCREF(value);
+    Py_XINCREF(tb);
+    if (tb == Py_None) {
+        Py_DECREF(tb);
+        tb = 0;
+    }
+    else if (tb != NULL && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto raise_error;
+    }
+    if (value == NULL) {
+        value = Py_None;
         Py_INCREF(value);
-    if (!tb || tb == Py_None)
-        tb = NULL;
-    else {
-        Py_INCREF(tb);
-        if (!PyTraceBack_Check(tb)) {
-            PyErr_SetString(PyExc_TypeError,
-                "raise: arg 3 must be a traceback or None");
-            goto raise_error;
-        }
     }
     #if PY_VERSION_HEX < 0x02050000
-    if (PyClass_Check(type)) {
+    if (!PyClass_Check(type))
     #else
-    if (PyType_Check(type)) {
+    if (!PyType_Check(type))
     #endif
-#if CYTHON_COMPILING_IN_PYPY
-        if (!value) {
-            Py_INCREF(Py_None);
-            value = Py_None;
-        }
-#endif
-        PyErr_NormalizeException(&type, &value, &tb);
-    } else {
-        if (value) {
+    {
+        if (value != Py_None) {
             PyErr_SetString(PyExc_TypeError,
                 "instance exception may not have a separate value");
             goto raise_error;
         }
+        Py_DECREF(value);
         value = type;
         #if PY_VERSION_HEX < 0x02050000
             if (PyInstance_Check(type)) {
@@ -12450,7 +12419,6 @@ raise_error:
 }
 #else /* Python 3+ */
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
-    PyObject* owned_instance = NULL;
     if (tb == Py_None) {
         tb = 0;
     } else if (tb && !PyTraceBack_Check(tb)) {
@@ -12468,36 +12436,12 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
         value = type;
         type = (PyObject*) Py_TYPE(value);
-    } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
-        }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
-        }
-    } else {
+    } else if (!PyExceptionClass_Check(type)) {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
-    if (cause && cause != Py_None) {
+    if (cause) {
         PyObject *fixed_cause;
         if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
@@ -12514,6 +12458,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
                             "BaseException");
             goto bad;
         }
+        if (!value) {
+            value = PyObject_CallObject(type, NULL);
+        }
         PyException_SetCause(value, fixed_cause);
     }
     PyErr_SetObject(type, value);
@@ -12527,7 +12474,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
     }
 bad:
-    Py_XDECREF(owned_instance);
     return;
 }
 #endif
@@ -12541,7 +12487,7 @@ static void __Pyx_RaiseDoubleKeywordsError(
         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
         #else
         "%s() got multiple values for keyword argument '%s'", func_name,
-        PyString_AsString(kw_name));
+        PyString_AS_STRING(kw_name));
         #endif
 }
 
@@ -12562,72 +12508,48 @@ static int __Pyx_ParseOptionalKeywords(
         while (*name && (**name != key)) name++;
         if (*name) {
             values[name-argnames] = value;
-            continue;
-        }
-        name = first_kw_arg;
-        #if PY_MAJOR_VERSION < 3
-        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
-            while (*name) {
-                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
-                        && _PyString_Eq(**name, key)) {
-                    values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    if ((**argname == key) || (
-                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
-                             && _PyString_Eq(**argname, key))) {
-                        goto arg_passed_twice;
-                    }
-                    argname++;
+        } else {
+            #if PY_MAJOR_VERSION < 3
+            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
+            #else
+            if (unlikely(!PyUnicode_Check(key))) {
+            #endif
+                goto invalid_keyword_type;
+            } else {
+                for (name = first_kw_arg; *name; name++) {
+                    #if PY_MAJOR_VERSION >= 3
+                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                        PyUnicode_Compare(**name, key) == 0) break;
+                    #else
+                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                        _PyString_Eq(**name, key)) break;
+                    #endif
                 }
-            }
-        } else
-        #endif
-        if (likely(PyUnicode_Check(key))) {
-            while (*name) {
-                int cmp = (**name == key) ? 0 :
-                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
-                #endif
-                    PyUnicode_Compare(**name, key);
-                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                if (cmp == 0) {
+                if (*name) {
                     values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    int cmp = (**argname == key) ? 0 :
-                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
-                    #endif
-                        PyUnicode_Compare(**argname, key);
-                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                    if (cmp == 0) goto arg_passed_twice;
-                    argname++;
+                } else {
+                    for (name=argnames; name != first_kw_arg; name++) {
+                        if (**name == key) goto arg_passed_twice;
+                        #if PY_MAJOR_VERSION >= 3
+                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
+                        #else
+                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                            _PyString_Eq(**name, key)) goto arg_passed_twice;
+                        #endif
+                    }
+                    if (kwds2) {
+                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+                    } else {
+                        goto invalid_keyword;
+                    }
                 }
             }
-        } else
-            goto invalid_keyword_type;
-        if (kwds2) {
-            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
-        } else {
-            goto invalid_keyword;
         }
     }
     return 0;
 arg_passed_twice:
-    __Pyx_RaiseDoubleKeywordsError(function_name, key);
+    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
     goto bad;
 invalid_keyword_type:
     PyErr_Format(PyExc_TypeError,
@@ -12666,54 +12588,22 @@ static void __Pyx_RaiseArgtupleInvalid(
         more_or_less = "exactly";
     }
     PyErr_Format(PyExc_TypeError,
-                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                  func_name, more_or_less, num_expected,
                  (num_expected == 1) ? "" : "s", num_found);
 }
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
-    PyErr_Format(PyExc_ValueError,
-                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
-}
+
 
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
     PyErr_Format(PyExc_ValueError,
-                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
+                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                  index, (index == 1) ? "" : "s");
 }
 
-static CYTHON_INLINE int __Pyx_IterFinish(void) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyThreadState *tstate = PyThreadState_GET();
-    PyObject* exc_type = tstate->curexc_type;
-    if (unlikely(exc_type)) {
-        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
-            PyObject *exc_value, *exc_tb;
-            exc_value = tstate->curexc_value;
-            exc_tb = tstate->curexc_traceback;
-            tstate->curexc_type = 0;
-            tstate->curexc_value = 0;
-            tstate->curexc_traceback = 0;
-            Py_DECREF(exc_type);
-            Py_XDECREF(exc_value);
-            Py_XDECREF(exc_tb);
-            return 0;
-        } else {
-            return -1;
-        }
-    }
-    return 0;
-#else
-    if (unlikely(PyErr_Occurred())) {
-        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
-            PyErr_Clear();
-            return 0;
-        } else {
-            return -1;
-        }
-    }
-    return 0;
-#endif
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+    PyErr_Format(PyExc_ValueError,
+                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
 }
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
@@ -12721,8 +12611,13 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
         Py_DECREF(retval);
         __Pyx_RaiseTooManyValuesError(expected);
         return -1;
-    } else {
-        return __Pyx_IterFinish();
+    } else if (PyErr_Occurred()) {
+        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
+            PyErr_Clear();
+            return 0;
+        } else {
+            return -1;
+        }
     }
     return 0;
 }
@@ -12747,9 +12642,12 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
+static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
+}
+
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
     PyObject *local_type, *local_value, *local_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
     local_type = tstate->curexc_type;
@@ -12758,27 +12656,19 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     tstate->curexc_type = 0;
     tstate->curexc_value = 0;
     tstate->curexc_traceback = 0;
-#else
-    PyErr_Fetch(&local_type, &local_value, &local_tb);
-#endif
     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
-#if CYTHON_COMPILING_IN_CPYTHON
     if (unlikely(tstate->curexc_type))
-#else
-    if (unlikely(PyErr_Occurred()))
-#endif
         goto bad;
     #if PY_MAJOR_VERSION >= 3
     if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
         goto bad;
     #endif
-    Py_INCREF(local_type);
-    Py_INCREF(local_value);
-    Py_INCREF(local_tb);
     *type = local_type;
     *value = local_value;
     *tb = local_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
+    Py_INCREF(local_type);
+    Py_INCREF(local_value);
+    Py_INCREF(local_tb);
     tmp_type = tstate->exc_type;
     tmp_value = tstate->exc_value;
     tmp_tb = tstate->exc_traceback;
@@ -12786,13 +12676,10 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     tstate->exc_value = local_value;
     tstate->exc_traceback = local_tb;
     /* Make sure tstate is in a consistent state when we XDECREF
-       these objects (DECREF may run arbitrary code). */
+       these objects (XDECREF may run arbitrary code). */
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
-#else
-    PyErr_SetExcInfo(local_type, local_value, local_tb);
-#endif
     return 0;
 bad:
     *type = 0;
@@ -12805,7 +12692,6 @@ bad:
 }
 
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
     *type = tstate->exc_type;
     *value = tstate->exc_value;
@@ -12813,12 +12699,8 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value,
     Py_XINCREF(*type);
     Py_XINCREF(*value);
     Py_XINCREF(*tb);
-#else
-    PyErr_GetExcInfo(type, value, tb);
-#endif
 }
 static void __Pyx_ExceptionReset(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->exc_type;
@@ -12830,9 +12712,6 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
-#else
-    PyErr_SetExcInfo(type, value, tb);
-#endif
 }
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
@@ -12906,6 +12785,7 @@ bad:
 
 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
     PyObject *metaclass;
+    /* Default metaclass */
 #if PY_MAJOR_VERSION < 3
     if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
         PyObject *base = PyTuple_GET_ITEM(bases, 0);
@@ -12935,6 +12815,7 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na
     PyObject *metaclass;
     if (PyDict_SetItemString(dict, "__module__", modname) < 0)
         return NULL;
+    /* Python2 __metaclass__ */
     metaclass = PyDict_GetItemString(dict, "__metaclass__");
     if (metaclass) {
         Py_INCREF(metaclass);
@@ -13226,56 +13107,6 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
                                PyString_AsString(func_name), (void *)op);
 #endif
 }
-#if CYTHON_COMPILING_IN_PYPY
-static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
-    PyCFunctionObject* f = (PyCFunctionObject*)func;
-    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
-    PyObject *self = PyCFunction_GET_SELF(func);
-    Py_ssize_t size;
-    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
-    case METH_VARARGS:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
-            return (*meth)(self, arg);
-        break;
-    case METH_VARARGS | METH_KEYWORDS:
-        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
-    case METH_NOARGS:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
-            size = PyTuple_GET_SIZE(arg);
-            if (size == 0)
-                return (*meth)(self, NULL);
-            PyErr_Format(PyExc_TypeError,
-                "%.200s() takes no arguments (%zd given)",
-                f->m_ml->ml_name, size);
-            return NULL;
-        }
-        break;
-    case METH_O:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
-            size = PyTuple_GET_SIZE(arg);
-            if (size == 1)
-                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
-            PyErr_Format(PyExc_TypeError,
-                "%.200s() takes exactly one argument (%zd given)",
-                f->m_ml->ml_name, size);
-            return NULL;
-        }
-        break;
-    default:
-        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
-                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
-                        "longer supported!");
-        return NULL;
-    }
-    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
-                 f->m_ml->ml_name);
-    return NULL;
-}
-#else
-static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
-	return PyCFunction_Call(func, arg, kw);
-}
-#endif
 static PyTypeObject __pyx_CyFunctionType_type = {
     PyVarObject_HEAD_INIT(0, 0)
     __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
@@ -13295,7 +13126,7 @@ static PyTypeObject __pyx_CyFunctionType_type = {
     0,                                  /*tp_as_sequence*/
     0,                                  /*tp_as_mapping*/
     0,                                  /*tp_hash*/
-    __Pyx_CyFunction_Call,              /*tp_call*/
+    __Pyx_PyCFunction_Call,             /*tp_call*/
     0,                                  /*tp_str*/
     0,                                  /*tp_getattro*/
     0,                                  /*tp_setattro*/
@@ -13331,16 +13162,15 @@ static PyTypeObject __pyx_CyFunctionType_type = {
     0,                                  /*tp_version_tag*/
 #endif
 };
-static int __Pyx_CyFunction_init(void) {
-#if !CYTHON_COMPILING_IN_PYPY
-    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
-#endif
+static int __Pyx_CyFunction_init(void)
+{
     if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
         return -1;
     __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
     return 0;
 }
-static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
+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)
@@ -13349,12 +13179,85 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t
     m->defaults_pyobjects = pyobjects;
     return m->defaults;
 }
-static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
+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) {
+        return (equals == Py_EQ);
+    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
+        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
+            return (equals == Py_NE);
+        } else if (PyBytes_GET_SIZE(s1) == 1) {
+            if (equals == Py_EQ)
+                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
+            else
+                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
+        } else {
+            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
+            return (equals == Py_EQ) ? (result == 0) : (result != 0);
+        }
+    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
+        return (equals == Py_NE);
+    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
+        return (equals == Py_NE);
+    } else {
+        int result;
+        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+        if (!py_result)
+            return -1;
+        result = __Pyx_PyObject_IsTrue(py_result);
+        Py_DECREF(py_result);
+        return result;
+    }
+}
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
+    if (s1 == s2) {
+        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
+        } else {
+            int result = PyUnicode_Compare(s1, s2);
+            if ((result == -1) && unlikely(PyErr_Occurred()))
+                return -1;
+            return (equals == Py_EQ) ? (result == 0) : (result != 0);
+        }
+    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
+        return (equals == Py_NE);
+    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
+        return (equals == Py_NE);
+    } else {
+        int result;
+        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+        if (!py_result)
+            return -1;
+        result = __Pyx_PyObject_IsTrue(py_result);
+        Py_DECREF(py_result);
+        return result;
+    }
+}
+
 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
     const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
     const int is_unsigned = const_zero < neg_one;
@@ -13384,10 +13287,6 @@ 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
@@ -13407,7 +13306,6 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
             if (likely(!ret))
                 return val;
         }
-        #endif
         return (int32_t)-1;
     }
 }
@@ -13848,23 +13746,6 @@ bad:
     return -1;
 }
 
-#ifndef __PYX_HAVE_RT_ImportModule
-#define __PYX_HAVE_RT_ImportModule
-static PyObject *__Pyx_ImportModule(const char *name) {
-    PyObject *py_name = 0;
-    PyObject *py_module = 0;
-    py_name = __Pyx_PyIdentifier_FromString(name);
-    if (!py_name)
-        goto bad;
-    py_module = PyImport_Import(py_name);
-    Py_DECREF(py_name);
-    return py_module;
-bad:
-    Py_XDECREF(py_name);
-    return 0;
-}
-#endif
-
 #ifndef __PYX_HAVE_RT_ImportType
 #define __PYX_HAVE_RT_ImportType
 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
@@ -13917,6 +13798,23 @@ bad:
 }
 #endif
 
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+    PyObject *py_name = 0;
+    PyObject *py_module = 0;
+    py_name = __Pyx_PyIdentifier_FromString(name);
+    if (!py_name)
+        goto bad;
+    py_module = PyImport_Import(py_name);
+    Py_DECREF(py_name);
+    return py_module;
+bad:
+    Py_XDECREF(py_name);
+    return 0;
+}
+#endif
+
 static void* __Pyx_GetVtable(PyObject *dict) {
     void* ptr;
     PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
diff --git a/pysam/cvcf.c b/pysam/cvcf.c
index 1754ba8..a4eb2db 100644
--- a/pysam/cvcf.c
+++ b/pysam/cvcf.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17.4 on Wed Jan 23 22:59:29 2013 */
+/* Generated by Cython 0.16 on Tue Jan 15 06:50:15 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -11,6 +11,7 @@
 #ifndef offsetof
 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
 #endif
+
 #if !defined(WIN32) && !defined(MS_WINDOWS)
   #ifndef __stdcall
     #define __stdcall
@@ -22,18 +23,22 @@
     #define __fastcall
   #endif
 #endif
+
 #ifndef DL_IMPORT
   #define DL_IMPORT(t) t
 #endif
 #ifndef DL_EXPORT
   #define DL_EXPORT(t) t
 #endif
+
 #ifndef PY_LONG_LONG
   #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
@@ -41,28 +46,28 @@
 #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
+#endif
+
 #if PY_VERSION_HEX < 0x02050000
   typedef int Py_ssize_t;
   #define PY_SSIZE_T_MAX INT_MAX
   #define PY_SSIZE_T_MIN INT_MIN
   #define PY_FORMAT_SIZE_T ""
-  #define CYTHON_FORMAT_SSIZE_T ""
   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
   #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
-  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
-                                (PyErr_Format(PyExc_TypeError, \
-                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
-                                 (PyObject*)0))
-  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
-                                  !PyComplex_Check(o))
-  #define PyIndex_Check __Pyx_PyIndex_Check
+  #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"
-  #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)
   #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
@@ -70,6 +75,7 @@
   #define PyVarObject_HEAD_INIT(type, size) \
           PyObject_HEAD_INIT(type) size,
   #define PyType_Modified(t)
+
   typedef struct {
      void *buf;
      PyObject *obj;
@@ -83,6 +89,7 @@
      Py_ssize_t *suboffsets;
      void *internal;
   } Py_buffer;
+
   #define PyBUF_SIMPLE 0
   #define PyBUF_WRITABLE 0x0001
   #define PyBUF_FORMAT 0x0004
@@ -94,9 +101,11 @@
   #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) \
@@ -106,30 +115,31 @@
   #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
   #define Py_TPFLAGS_CHECKTYPES 0
   #define Py_TPFLAGS_HAVE_INDEX 0
 #endif
+
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
-#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+
+
+#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
   #define CYTHON_PEP393_ENABLED 1
-  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
-                                              0 : _PyUnicode_Ready((PyObject *)(op)))
-  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
+  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
-  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
 #else
   #define CYTHON_PEP393_ENABLED 0
-  #define __Pyx_PyUnicode_READY(op)       (0)
-  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
+  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
-  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
 #endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyBaseString_Type            PyUnicode_Type
   #define PyStringObject               PyUnicodeObject
@@ -137,6 +147,7 @@
   #define PyString_Check               PyUnicode_Check
   #define PyString_CheckExact          PyUnicode_CheckExact
 #endif
+
 #if PY_VERSION_HEX < 0x02060000
   #define PyBytesObject                PyStringObject
   #define PyBytes_Type                 PyString_Type
@@ -155,6 +166,7 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -162,7 +174,9 @@
 #ifndef PySet_CheckExact
   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
 #endif
+
 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
 #if PY_MAJOR_VERSION >= 3
   #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
@@ -179,9 +193,11 @@
   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 #endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyBoolObject                 PyLongObject
 #endif
+
 #if PY_VERSION_HEX < 0x03020000
   typedef long Py_hash_t;
   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
@@ -190,6 +206,7 @@
   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
 #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)
@@ -208,9 +225,11 @@
         (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
             (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
 #endif
+
 #if PY_MAJOR_VERSION >= 3
   #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
+
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
@@ -220,6 +239,7 @@
   #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
   #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
 #endif
+
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_NAMESTR(n) ((char *)(n))
   #define __Pyx_DOCSTR(n)  ((char *)(n))
@@ -228,7 +248,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)
@@ -316,11 +335,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
-#if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
-#else
-#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
-#endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
 
 #ifdef __GNUC__
@@ -897,47 +912,42 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j
                                                     __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 CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+            PyObject *r = PyList_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
 }
 #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 CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
     }
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
 }
 #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 CYTHON_COMPILING_IN_CPYTHON
     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)))) {
@@ -953,22 +963,13 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i)
             Py_INCREF(r);
             return r;
         }
-    } else {  /* inlined PySequence_GetItem() */
+    }
+    else if (likely(i >= 0)) {
         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
         if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
             return m->sq_item(o, i);
         }
     }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
 
@@ -980,22 +981,21 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
 
 static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
-#if CYTHON_COMPILING_IN_PYPY
-#define __Pyx_PyObject_AsDouble(obj) \
-(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
- likely(PyInt_CheckExact(obj)) ? \
- PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
-#else
 #define __Pyx_PyObject_AsDouble(obj) \
 ((likely(PyFloat_CheckExact(obj))) ? \
  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
-#endif
 
 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
 
+static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
+
 #if PY_MAJOR_VERSION >= 3
 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     PyObject *value;
+    if (unlikely(d == Py_None)) {
+        __Pyx_RaiseNoneIndexingError();
+        return NULL;
+    }
     value = PyDict_GetItemWithError(d, key);
     if (unlikely(!value)) {
         if (!PyErr_Occurred())
@@ -1009,48 +1009,28 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
     #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
 #endif
 
-static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
-    int result = PySequence_Contains(seq, item);
-    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+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);
 }
-
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
 
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
 
-static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
+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_PyDict_Contains(PyObject* item, PyObject* dict, int eq) {
-    int result = PyDict_Contains(dict, item);
-    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
-}
-
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
-    PyListObject* L = (PyListObject*) list;
-    Py_ssize_t len = Py_SIZE(list);
-    if (likely(L->allocated > len)) {
-        Py_INCREF(x);
-        PyList_SET_ITEM(list, len, x);
-        Py_SIZE(list) = len+1;
-        return 0;
-    }
-    return PyList_Append(list, x);
-}
-#else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
-#endif
-
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
     if (likely(PyList_CheckExact(L))) {
-        if (unlikely(PyList_Append(L, x) < 0)) return NULL;
+        if (PyList_Append(L, x) < 0) return NULL;
         Py_INCREF(Py_None);
         return Py_None; /* this is just to have an accurate signature */
-    } else {
+    }
+    else {
         PyObject *r, *m;
         m = __Pyx_GetAttrString(L, "append");
         if (!m) return NULL;
@@ -1060,18 +1040,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
     }
 }
 
-static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
-
-static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
-
-static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
-                                             int is_tuple, int has_known_size, int decref_tuple);
-
-static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
-                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
-static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
-                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
-
 #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                     __Pyx_SetItemInt_Fast(o, i, v) : \
                                                     __Pyx_SetItemInt_Generic(o, to_py_func(i), v))
@@ -1083,7 +1051,6 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb
     return r;
 }
 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) {
-#if CYTHON_COMPILING_IN_CPYTHON
     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)))) {
@@ -1093,26 +1060,13 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje
             Py_DECREF(old);
             return 1;
         }
-    } else {  /* inlined PySequence_SetItem() */
+    }
+    else if (likely(i >= 0)) {
         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
         if (likely(m && m->sq_ass_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return -1;
-                i += l;
-            }
             return m->sq_ass_item(o, i, v);
         }
     }
-#else
-#if CYTHON_COMPILING_IN_PYPY
-    if (PySequence_Check(o) && !PyDict_Check(o)) {
-#else
-    if (PySequence_Check(o)) {
-#endif
-        return PySequence_SetItem(o, i, v);
-    }
-#endif
     return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
 }
 
@@ -1151,12 +1105,6 @@ static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
 #endif /* PyAnySet_CheckExact (<= Py2.4) */
 #endif /* < Py2.5  */
 
-static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);
-
-static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);
-
-static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);
-
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
@@ -1213,6 +1161,18 @@ static int __Pyx_CyFunction_init(void);
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
 
+#include <string.h>
+
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
+
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
 
 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
@@ -1249,30 +1209,22 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
 
 #define __Pyx_Generator_USED
 #include <structmember.h>
-#include <frameobject.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;
-    PyObject *yieldfrom;
-    int resume_label;
-    char is_running;  // using T_BOOL for property below requires char value
 } __pyx_GeneratorObject;
 static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                   PyObject *closure);
 static int __pyx_Generator_init(void);
-static int __Pyx_Generator_clear(PyObject* self);
-#if 1 || PY_VERSION_HEX < 0x030300B0
-static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
-#else
-#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
-#endif
 
 static int __Pyx_check_binary_version(void);
 
@@ -1284,10 +1236,10 @@ static int __Pyx_check_binary_version(void);
 #endif
 #endif
 
-static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
-
 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*/
+
 static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
 
 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
@@ -1518,7 +1470,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_135[] = "pysam.cvcf";
 static char __pyx_k_138[] = "id numbertype number type description missingvalue";
 static char __pyx_k_140[] = "UNKNOWN_FORMAT_STRING:Unknown file format identifier";
@@ -2402,11 +2354,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_1get_sequence(PyObject *__pyx_self, PyObj
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_fa = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__fa,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("get_sequence (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__fa,0};
     PyObject* values[4] = {0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -2422,20 +2375,24 @@ static PyObject *__pyx_pw_5pysam_4cvcf_1get_sequence(PyObject *__pyx_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fa)) != 0)) kw_args--;
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fa);
+        if (likely(values[3])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -2500,7 +2457,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__py
  *     if not fa: return "N"*(end-start)
  *     if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper()
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_v_start, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_v_start, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
@@ -2542,7 +2500,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__py
  *     sequence = fa.fetch(chrom, start, end).upper()
  *     if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence))
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (__pyx_t_3) {
@@ -2634,7 +2593,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_get_sequence(CYTHON_UNUSED PyObject *__py
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_6 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2697,6 +2657,7 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3parse_regions(PyObject *__pyx_self, PyOb
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_regions (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_4cvcf_2parse_regions(__pyx_self, ((PyObject *)__pyx_v_string));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -2775,18 +2736,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__
   for (;;) {
     if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
     } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
     } else {
       __pyx_t_2 = __pyx_t_4(__pyx_t_1);
       if (unlikely(!__pyx_t_2)) {
@@ -3112,11 +3065,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_2parse_regions(CYTHON_UNUSED PyObject *__
 static int __pyx_pw_5pysam_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pw_5pysam_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_vcf = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -3129,7 +3082,8 @@ static int __pyx_pw_5pysam_4cvcf_9VCFRecord_1__init__(PyObject *__pyx_v_self, Py
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
@@ -3190,11 +3144,11 @@ static int __pyx_pf_5pysam_4cvcf_9VCFRecord___init__(struct __pyx_obj_5pysam_4cv
 static int __pyx_pw_5pysam_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pw_5pysam_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_vcf = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -3207,7 +3161,8 @@ static int __pyx_pw_5pysam_4cvcf_9VCFRecord_3__cinit__(PyObject *__pyx_v_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
@@ -3280,11 +3235,11 @@ static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_5error(PyObject *__pyx_v_self,
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_error = 0;
   PyObject *__pyx_v_opt = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("error (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0};
     PyObject* values[3] = {0,0,0};
 
     /* "pysam/cvcf.pyx":121
@@ -3308,10 +3263,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_9VCFRecord_5error(PyObject *__pyx_v_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("error", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -3746,9 +3703,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_3alt___get__(struct __pyx_obj_
  *             else: alt = alt.upper().split(',')
  *             return alt
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_v_alt, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_2) {
     __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -3868,9 +3823,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4qual___get__(struct __pyx_obj
  *             else:
  *                 try:    qual = float(qual)
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, ((PyObject *)__pyx_kp_b_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_2 = __Pyx_PyBytes_Equals(__pyx_v_qual, ((PyObject *)__pyx_kp_b_9), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_2) {
     __Pyx_INCREF(__pyx_int_neg_1);
     __Pyx_DECREF(__pyx_v_qual);
@@ -4036,21 +3989,24 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_6filter___get__(struct __pyx_o
  */
   __pyx_t_1 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (!__pyx_t_3) {
     __pyx_t_2 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_b__PASS), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_b__PASS), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (!__pyx_t_4) {
       __pyx_t_1 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-      __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b__0), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b__0), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -4180,7 +4136,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj
  */
   __pyx_t_1 = PyBytes_FromString(__pyx_v_col); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -4213,18 +4170,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_4info___get__(struct __pyx_obj
     for (;;) {
       if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
       } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
       } else {
         __pyx_t_2 = __pyx_t_5(__pyx_t_1);
         if (unlikely(!__pyx_t_2)) {
@@ -4745,18 +4694,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_
   for (;;) {
     if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_9)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
     } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_9)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
     } else {
       __pyx_t_8 = __pyx_t_10(__pyx_t_9);
       if (unlikely(!__pyx_t_8)) {
@@ -4814,7 +4755,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_
     __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -4835,7 +4777,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_
  *                 else: value = ",".join(["."]*expected)
  * 
  */
-      __pyx_t_1 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); 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_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_5) {
@@ -4936,7 +4879,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_
  *                 self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS,
  *                            "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]]))
  */
-    __pyx_t_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_5) {
@@ -4949,7 +4893,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_v_expected, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -5042,7 +4987,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_13 = PyObject_RichCompare(__pyx_t_8, __pyx_v_expected, Py_LT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_13 = PyObject_RichCompare(__pyx_t_8, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_13);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
@@ -5161,11 +5107,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_9VCFRecord_8__getitem__(struct __pyx_obj_
 static int __pyx_pw_5pysam_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pw_5pysam_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_vcffile = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcffile,0};
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcffile,0};
     PyObject* values[1] = {0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5178,7 +5124,8 @@ static int __pyx_pw_5pysam_4cvcf_11asVCFRecord_1__init__(PyObject *__pyx_v_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcffile)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcffile);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
@@ -5240,11 +5187,11 @@ static PyObject *__pyx_pw_5pysam_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v
 static PyObject *__pyx_pw_5pysam_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   char *__pyx_v_buffer;
   int __pyx_v_len;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -5258,10 +5205,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_11asVCFRecord_3__call__(PyObject *__pyx_v
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -5425,11 +5374,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_1__init__(PyObject *__pyx_self, PyOb
   PyObject *__pyx_v_regions = 0;
   PyObject *__pyx_v_lines = 0;
   PyObject *__pyx_v_leftalign = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s___copy,&__pyx_n_s__reference,&__pyx_n_s__regions,&__pyx_n_s__lines,&__pyx_n_s__leftalign,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s___copy,&__pyx_n_s__reference,&__pyx_n_s__regions,&__pyx_n_s__lines,&__pyx_n_s__leftalign,0};
     PyObject* values[6] = {0,0,0,0,0,0};
     __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
     values[1] = ((PyObject *)((PyObject *)Py_None));
@@ -5453,7 +5403,8 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_1__init__(PyObject *__pyx_self, PyOb
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -5559,18 +5510,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__p
   for (;;) {
     if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
       if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __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)) {
       if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
     } else {
       __pyx_t_1 = __pyx_t_4(__pyx_t_2);
       if (unlikely(!__pyx_t_1)) {
@@ -5614,7 +5557,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF___init__(CYTHON_UNUSED PyObject *__p
  *             self._leftalign = _copy._leftalign
  *             self._header = _copy._header[:]
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v__copy, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v__copy, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_7) {
@@ -5931,11 +5875,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_3error(PyObject *__pyx_self, PyObjec
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_error = 0;
   PyObject *__pyx_v_opt = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("error (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0};
     PyObject* values[4] = {0,0,0,0};
 
     /* "pysam/cvcf.pyx":335
@@ -5960,15 +5905,18 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_3error(PyObject *__pyx_self, PyObjec
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("error", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("error", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -6035,7 +5983,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___ignored_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_error, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((PySequence_Contains(__pyx_t_1, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
     __Pyx_XDECREF(__pyx_r);
@@ -6065,33 +6013,27 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
     PyObject* sequence = __pyx_t_3;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    Py_ssize_t size = Py_SIZE(sequence);
-    #else
-    Py_ssize_t size = PySequence_Size(sequence);
-    #endif
-    if (unlikely(size != 2)) {
-      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #if CYTHON_COMPILING_IN_CPYTHON
     if (likely(PyTuple_CheckExact(sequence))) {
+      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
     } else {
+      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
       __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
       __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
     }
     __Pyx_INCREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_t_4);
-    #else
-    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #endif
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  } else
-  {
+  } else {
     Py_ssize_t index = -1;
     __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
@@ -6102,13 +6044,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx
     index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
     if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
-    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
@@ -6152,7 +6093,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Warning));
   __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_error, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((PySequence_Contains(__pyx_t_4, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_3), __pyx_t_2, sizeof(int), __Pyx_PyBool_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
@@ -6205,7 +6146,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_2error(CYTHON_UNUSED PyObject *__pyx
  */
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_error, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((PySequence_Contains(__pyx_t_3, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_2) {
     __Pyx_XDECREF(__pyx_r);
@@ -6298,11 +6239,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_5parse_format(PyObject *__pyx_self,
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_filter = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__format,&__pyx_n_s__filter,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_format (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__format,&__pyx_n_s__filter,0};
     PyObject* values[4] = {0,0,0,0};
     __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
     values[3] = __pyx_dynamic_args->__pyx_arg_filter;
@@ -6320,15 +6262,18 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_5parse_format(PyObject *__pyx_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_format", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_format", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -6409,7 +6354,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_40, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_40, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __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 = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -6654,7 +6600,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
     __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -6664,7 +6611,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
       __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -6679,7 +6627,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
         __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6703,7 +6652,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
       __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_int_40, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_int_40, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -6736,7 +6686,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *                 first = ["ID=","Number=","Type=","Description="][idx] + first
  *             if first.startswith('ID='):            data['id'] = first.split('=')[1]
  */
-      __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       if (__pyx_t_4) {
@@ -7098,7 +7049,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_filter); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_4) {
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_9 = __pyx_t_3;
@@ -7155,7 +7107,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *             # missing description
  *             self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  */
-  __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__descr), ((PyObject *)__pyx_v_data), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_4) {
 
     /* "pysam/cvcf.pyx":381
@@ -7275,37 +7227,27 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
   __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Integer), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!((int)__pyx_t_4)) {
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Float), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = ((int)__pyx_t_9);
   } else {
     __pyx_t_3 = ((int)__pyx_t_4);
   }
   if (!__pyx_t_3) {
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Character), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_9 = ((int)__pyx_t_4);
   } else {
     __pyx_t_9 = __pyx_t_3;
   }
   if (!__pyx_t_9) {
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__String), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_4 = ((int)__pyx_t_3);
   } else {
     __pyx_t_4 = __pyx_t_9;
   }
   if (!__pyx_t_4) {
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_3 = ((int)__pyx_t_9);
   } else {
     __pyx_t_3 = __pyx_t_4;
@@ -7351,13 +7293,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
   __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Integer), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!((int)__pyx_t_4)) {
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Float), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_9 = ((int)__pyx_t_3);
   } else {
     __pyx_t_9 = ((int)__pyx_t_4);
@@ -7507,16 +7445,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
       __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_9) {
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+        __Pyx_GOTREF(__pyx_t_7);
         __Pyx_XDECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_t = __pyx_t_7;
+        __pyx_t_7 = 0;
         goto __pyx_L31;
       }
 
@@ -7527,11 +7463,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *             elif data['number'] == '#nonref_alleles':   t = self.NT_NR_ALLELES
  *             elif data['number'] == '#genotypes':        t = self.NT_GENOTYPES
  */
-      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_53), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_53), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_9) {
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
@@ -7551,16 +7485,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
       __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_54), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_54), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_9) {
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+        __Pyx_GOTREF(__pyx_t_7);
         __Pyx_XDECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_t = __pyx_t_7;
+        __pyx_t_7 = 0;
         goto __pyx_L31;
       }
 
@@ -7571,11 +7503,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *             elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES
  *             elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES
  */
-      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_55), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_55), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_9) {
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
@@ -7595,16 +7525,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
       __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_56), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_56), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_9) {
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+        __Pyx_GOTREF(__pyx_t_7);
         __Pyx_XDECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_t = __pyx_t_7;
+        __pyx_t_7 = 0;
         goto __pyx_L31;
       }
 
@@ -7615,11 +7543,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *             # abbreviations added in VCF version v4.1
  *             elif data['number'] == 'A': t = self.NT_ALLELES
  */
-      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_56), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_kp_s_56), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_9) {
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
@@ -7639,16 +7565,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  */
       __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__A), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_9) {
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+        __Pyx_GOTREF(__pyx_t_7);
         __Pyx_XDECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_t = __pyx_t_7;
+        __pyx_t_7 = 0;
         goto __pyx_L31;
       }
 
@@ -7659,11 +7583,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *             else:
  *                 self.error(line,self.BADLY_FORMATTED_FORMAT_STRING)
  */
-      __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__G), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_n_s__G), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_9) {
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
@@ -7727,16 +7649,15 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *             self.error( line, self.ZERO_FOR_NON_FLAG_FIELD)
  *             # force type 'Flag' if no number
  */
-  __pyx_t_10 = PyObject_RichCompare(__pyx_v_n, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = PyObject_RichCompare(__pyx_v_n, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   if (__pyx_t_9) {
     __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_1 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Flag), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_n_s__Flag), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = __pyx_t_4;
   } else {
     __pyx_t_3 = __pyx_t_9;
@@ -7750,23 +7671,23 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *             # force type 'Flag' if no number
  *             data['type'] = 'Flag'
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_57); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_57); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __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 = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_INCREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_10);
-    __Pyx_GIVEREF(__pyx_t_10);
-    __pyx_t_10 = 0;
-    __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
     /* "pysam/cvcf.pyx":412
  *             self.error( line, self.ZERO_FOR_NON_FLAG_FIELD)
@@ -7788,13 +7709,13 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
  *     def format_format( self, fmt, filter=False ):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   if (unlikely(!__pyx_v_t)) { __Pyx_RaiseUnboundLocalError("t"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_15 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing)); if (!__pyx_t_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -7809,19 +7730,19 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_4parse_format(CYTHON_UNUSED PyObject
   __Pyx_INCREF(__pyx_v_n);
   PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_n);
   __Pyx_GIVEREF(__pyx_v_n);
-  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_10);
+  __Pyx_GIVEREF(__pyx_t_10);
   PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_15);
   __Pyx_GIVEREF(__pyx_t_15);
   __pyx_t_5 = 0;
-  __pyx_t_1 = 0;
+  __pyx_t_10 = 0;
   __pyx_t_2 = 0;
   __pyx_t_15 = 0;
-  __pyx_t_15 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_15);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
   __pyx_r = __pyx_t_15;
   __pyx_t_15 = 0;
@@ -7897,11 +7818,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_7format_format(PyObject *__pyx_self,
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_fmt = 0;
   PyObject *__pyx_v_filter = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fmt,&__pyx_n_s__filter,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("format_format (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fmt,&__pyx_n_s__filter,0};
     PyObject* values[3] = {0,0,0};
     __pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self);
     values[2] = __pyx_dynamic_args->__pyx_arg_filter;
@@ -7918,10 +7840,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_7format_format(PyObject *__pyx_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fmt)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fmt);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("format_format", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -8020,7 +7944,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__number); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __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 = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -8044,7 +7969,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8066,7 +7992,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8098,7 +8025,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8120,7 +8048,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8142,7 +8071,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8164,7 +8094,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8278,7 +8209,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -8298,40 +8230,30 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
     __pyx_t_6 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
     for (;;) {
       if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++;
       if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
         PyObject* sequence = __pyx_t_9;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        Py_ssize_t size = Py_SIZE(sequence);
-        #else
-        Py_ssize_t size = PySequence_Size(sequence);
-        #endif
-        if (unlikely(size != 2)) {
-          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        #if CYTHON_COMPILING_IN_CPYTHON
         if (likely(PyTuple_CheckExact(sequence))) {
+          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
           __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
         } else {
+          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
           __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
           __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
         }
         __Pyx_INCREF(__pyx_t_10);
         __Pyx_INCREF(__pyx_t_11);
-        #else
-        __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      } else
-      {
+      } else {
         Py_ssize_t index = -1;
         __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_12);
@@ -8342,13 +8264,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
         index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L8_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_11);
         if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_13 = NULL;
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         goto __pyx_L9_unpacking_done;
         __pyx_L8_unpacking_failed:;
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        __pyx_t_13 = NULL;
-        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_L9_unpacking_done:;
       }
@@ -8358,7 +8279,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
       __Pyx_XDECREF(__pyx_v_v);
       __pyx_v_v = __pyx_t_11;
       __pyx_t_11 = 0;
-      if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_v))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_v))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __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 = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8391,40 +8312,30 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
     __pyx_t_2 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
     for (;;) {
       if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++;
       if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
         PyObject* sequence = __pyx_t_9;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        Py_ssize_t size = Py_SIZE(sequence);
-        #else
-        Py_ssize_t size = PySequence_Size(sequence);
-        #endif
-        if (unlikely(size != 2)) {
-          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        #if CYTHON_COMPILING_IN_CPYTHON
         if (likely(PyTuple_CheckExact(sequence))) {
+          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
           __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
           __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
         } else {
+          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
           __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
           __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
         }
         __Pyx_INCREF(__pyx_t_11);
         __Pyx_INCREF(__pyx_t_10);
-        #else
-        __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      } else
-      {
+      } else {
         Py_ssize_t index = -1;
         __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_12);
@@ -8435,13 +8346,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
         index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L12_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_10);
         if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_13 = NULL;
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         goto __pyx_L13_unpacking_done;
         __pyx_L12_unpacking_failed:;
         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        __pyx_t_13 = NULL;
-        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_L13_unpacking_done:;
       }
@@ -8462,7 +8372,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_6format_format(CYTHON_UNUSED PyObjec
       __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_59), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_10));
       __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-      if (unlikely(__Pyx_PyList_Append(__pyx_t_6, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(PyList_Append(__pyx_t_6, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -8530,11 +8440,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_9get_expected(PyObject *__pyx_self,
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_formatdict = 0;
   PyObject *__pyx_v_alt = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,&__pyx_n_s__formatdict,&__pyx_n_s__alt,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("get_expected (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,&__pyx_n_s__formatdict,&__pyx_n_s__alt,0};
     PyObject* values[4] = {0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -8550,20 +8461,24 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_9get_expected(PyObject *__pyx_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt)) != 0)) kw_args--;
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt);
+        if (likely(values[3])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -8643,7 +8558,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8668,7 +8584,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8695,7 +8612,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8723,7 +8641,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8751,7 +8670,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8780,7 +8700,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_8get_expected(CYTHON_UNUSED PyObject
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8834,11 +8755,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_11_add_definition(PyObject *__pyx_se
   PyObject *__pyx_v_key = 0;
   PyObject *__pyx_v_data = 0;
   PyObject *__pyx_v_line = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__formatdict,&__pyx_n_s__key,&__pyx_n_s__data,&__pyx_n_s__line,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_add_definition (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__formatdict,&__pyx_n_s__key,&__pyx_n_s__data,&__pyx_n_s__line,0};
     PyObject* values[5] = {0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -8855,25 +8777,30 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_11_add_definition(PyObject *__pyx_se
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--;
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
+        if (likely(values[3])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  4:
-        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[4])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -8937,7 +8864,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyOb
  *         self.error(line,self.ERROR_UNKNOWN_KEY,key)
  *         if data == None:
  */
-  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_key, __pyx_v_formatdict, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = ((PySequence_Contains(__pyx_v_formatdict, __pyx_v_key))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -8981,7 +8908,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyOb
  *             formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".")
  *             return
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_data, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_data, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_1) {
@@ -9047,7 +8975,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyOb
  */
   __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_data, ((PyObject *)__pyx_t_4), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_data, ((PyObject *)__pyx_t_4), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -9075,7 +9004,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyOb
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_2)), ((PyObject *)Py_TYPE(__pyx_t_4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_2)), ((PyObject *)Py_TYPE(__pyx_t_4)), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __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_4); __pyx_t_4 = 0;
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9143,7 +9073,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_10_add_definition(CYTHON_UNUSED PyOb
  */
   __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_data, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_4)), ((PyObject *)Py_TYPE(__pyx_int_0)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_4)), ((PyObject *)Py_TYPE(__pyx_int_0)), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -9308,11 +9239,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_13format_formatdata(PyObject *__pyx_
   PyObject *__pyx_v_key = 0;
   PyObject *__pyx_v_value = 0;
   PyObject *__pyx_v_separator = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__data,&__pyx_n_s__format,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__separator,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("format_formatdata (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__data,&__pyx_n_s__format,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__separator,0};
     PyObject* values[6] = {0,0,0,0,0,0};
     __pyx_defaults3 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self);
     values[3] = __pyx_dynamic_args->__pyx_arg_key;
@@ -9334,15 +9266,18 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_13format_formatdata(PyObject *__pyx_
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("format_formatdata", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("format_formatdata", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -9452,7 +9387,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
  */
   __pyx_t_2 = PyList_New(0); 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_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(((PyObject *)__pyx_t_2))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(((PyObject *)__pyx_t_2))), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -9488,18 +9424,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
     for (;;) {
       if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
       } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
       } else {
         __pyx_t_2 = __pyx_t_5(__pyx_t_1);
         if (unlikely(!__pyx_t_2)) {
@@ -9553,18 +9481,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else {
       __pyx_t_2 = __pyx_t_5(__pyx_t_1);
       if (unlikely(!__pyx_t_2)) {
@@ -9634,18 +9554,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
     for (;;) {
       if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) {
         if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_7 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++;
       } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) {
         if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_7 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++;
       } else {
         __pyx_t_7 = __pyx_t_9(__pyx_t_2);
         if (unlikely(!__pyx_t_7)) {
@@ -9681,7 +9593,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
       __pyx_t_10 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, __pyx_t_10, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -9717,18 +9630,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
     } else {
       __pyx_t_6 = __pyx_t_5(__pyx_t_1);
       if (unlikely(!__pyx_t_6)) {
@@ -9751,9 +9656,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
  *         sdata.sort()
  *         if 'GT' in data:
  */
-    __pyx_t_6 = PyObject_RichCompare(__pyx_v_k, ((PyObject *)__pyx_n_s__GT), Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_k, ((PyObject *)__pyx_n_s__GT), Py_NE); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_3) {
       __pyx_t_6 = PyObject_GetItem(__pyx_v_data, __pyx_v_k); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -9789,7 +9692,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
  *             sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata
  *         for k,v in sdata:
  */
-  __pyx_t_3 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__GT), __pyx_v_data, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = ((PySequence_Contains(__pyx_v_data, ((PyObject *)__pyx_n_s__GT)))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_3) {
 
     /* "pysam/cvcf.pyx":480
@@ -9847,40 +9750,30 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
   __pyx_t_6 = ((PyObject *)__pyx_v_sdata); __Pyx_INCREF(__pyx_t_6); __pyx_t_4 = 0;
   for (;;) {
     if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_6)) break;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #else
-    __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #endif
+    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
       PyObject* sequence = __pyx_t_2;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
+        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
       }
       __Pyx_INCREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_t_7);
-      #else
-      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    } else
-    {
+    } else {
       Py_ssize_t index = -1;
       __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
@@ -9891,13 +9784,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
       index = 1; __pyx_t_7 = __pyx_t_12(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L17_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_7);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_12 = NULL;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       goto __pyx_L18_unpacking_done;
       __pyx_L17_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_12 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L18_unpacking_done:;
     }
@@ -9917,7 +9809,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
  */
     __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_t_2), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_t_2), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -9952,7 +9845,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
  *                 else: output.append( k )
  *             elif key: output.append(k)
  */
-      __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       if (__pyx_t_14) {
@@ -10033,7 +9927,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
  *                 else: output.append( "." )                    # should not happen
  *         # snip off trailing missing data
  */
-      __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_14) {
@@ -10093,10 +9988,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
  */
   while (1) {
     if (unlikely(((PyObject *)__pyx_v_output) == Py_None)) {
-      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
     }
-    __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_output)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_output)); 
     __pyx_t_14 = (__pyx_t_4 > 1);
     if (!__pyx_t_14) break;
 
@@ -10107,10 +10001,6 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_12format_formatdata(CYTHON_UNUSED Py
  *             if len(last)>0: break
  *             output = output[:-1]
  */
-    if (unlikely(((PyObject *)__pyx_v_output) == Py_None)) {
-      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
     __pyx_t_6 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_output), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -10213,6 +10103,7 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_15enter_default_format(PyObject *__p
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("enter_default_format (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_14enter_default_format(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -10812,11 +10703,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED
  *                   FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.'),
  */
     if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_14)) break;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_16 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_17); __Pyx_INCREF(__pyx_t_16); __pyx_t_17++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #else
-    __pyx_t_16 = PySequence_ITEM(__pyx_t_14, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #endif
+    __pyx_t_16 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_17); __Pyx_INCREF(__pyx_t_16); __pyx_t_17++;
     __Pyx_XDECREF(__pyx_v_f);
     __pyx_v_f = __pyx_t_16;
     __pyx_t_16 = 0;
@@ -10832,7 +10719,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_14enter_default_format(CYTHON_UNUSED
     __Pyx_GOTREF(__pyx_t_16);
     __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_18 = (__Pyx_PySequence_Contains(__pyx_t_16, __pyx_t_13, Py_NE)); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_18 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_13, __pyx_t_16))); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
     if (__pyx_t_18) {
@@ -10891,11 +10778,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_17parse_header = {__Pyx_NAMESTR(
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_17parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_header (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -10909,10 +10797,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_17parse_header(PyObject *__pyx_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -11060,9 +10950,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObjec
  *             if value == "VCFv3.3":
  *                 self._version = 33
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__fileformat), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_key, ((PyObject *)__pyx_n_s__fileformat), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_3) {
 
     /* "pysam/cvcf.pyx":523
@@ -11072,9 +10960,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObjec
  *                 self._version = 33
  *             elif value == "VCFv4.0":
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_79), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_value, ((PyObject *)__pyx_kp_s_79), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_3) {
 
       /* "pysam/cvcf.pyx":524
@@ -11095,9 +10981,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObjec
  *                 self._version = 40
  *             elif value == "VCFv4.1":
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_80), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_value, ((PyObject *)__pyx_kp_s_80), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_3) {
 
       /* "pysam/cvcf.pyx":526
@@ -11118,9 +11002,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObjec
  *                 # AH - for testing
  *                 self._version = 40
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_81), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_value, ((PyObject *)__pyx_kp_s_81), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_3) {
 
       /* "pysam/cvcf.pyx":529
@@ -11171,9 +11053,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObjec
  *             f = self.parse_format(line, value)
  *             self._info[ f.id ] = f
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__INFO), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_key, ((PyObject *)__pyx_n_s__INFO), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_3) {
 
     /* "pysam/cvcf.pyx":533
@@ -11224,9 +11104,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObjec
  *             f = self.parse_format(line, value, filter=True)
  *             self._filter[ f.id ] = f
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __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 = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_key, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_3) {
 
     /* "pysam/cvcf.pyx":536
@@ -11284,9 +11162,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_16parse_header(CYTHON_UNUSED PyObjec
  *             f = self.parse_format(line, value)
  *             self._format[ f.id ] = f
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FORMAT), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_key, ((PyObject *)__pyx_n_s__FORMAT), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_3) {
 
     /* "pysam/cvcf.pyx":539
@@ -11381,11 +11257,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_19write_header = {__Pyx_NAMESTR(
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_19write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write_header (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -11399,10 +11276,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_19write_header(PyObject *__pyx_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -11457,11 +11336,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
   PyObject *__pyx_t_7 = NULL;
   PyObject *(*__pyx_t_8)(PyObject *);
   Py_ssize_t __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
+  PyObject *__pyx_t_10 = NULL;
   int __pyx_t_11;
-  int __pyx_t_12;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11529,18 +11406,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
   for (;;) {
     if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) {
       if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++;
     } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
       if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++;
     } else {
       __pyx_t_4 = __pyx_t_6(__pyx_t_2);
       if (unlikely(!__pyx_t_4)) {
@@ -11554,33 +11423,27 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
     }
     if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
       PyObject* sequence = __pyx_t_4;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
+        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
       }
       __Pyx_INCREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_t_3);
-      #else
-      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    } else
-    {
+    } else {
       Py_ssize_t index = -1;
       __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
@@ -11591,13 +11454,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
       index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_3);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_8 = NULL;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L6_unpacking_done;
       __pyx_L5_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_8 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L6_unpacking_done:;
     }
@@ -11685,40 +11547,30 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   for (;;) {
     if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
-    #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #else
-    __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    #endif
+    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
     if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
       PyObject* sequence = __pyx_t_2;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
       if (likely(PyTuple_CheckExact(sequence))) {
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
+        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
         __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
         __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
       }
       __Pyx_INCREF(__pyx_t_3);
       __Pyx_INCREF(__pyx_t_1);
-      #else
-      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    } else
-    {
+    } else {
       Py_ssize_t index = -1;
       __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
@@ -11729,13 +11581,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
       index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
       __Pyx_GOTREF(__pyx_t_1);
       if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_8 = NULL;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L10_unpacking_done;
       __pyx_L9_unpacking_failed:;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_8 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L10_unpacking_done:;
     }
@@ -11753,21 +11604,38 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
  * 
  * 
  */
-    __pyx_t_9 = 0;
-    if (unlikely(__pyx_v_var == Py_None)) {
-      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "itervalues");
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_var, 0, ((PyObject *)__pyx_n_s__itervalues), (&__pyx_t_10), (&__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_var, __pyx_n_s__itervalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __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 = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_t_2);
-    __pyx_t_2 = __pyx_t_1;
-    __pyx_t_1 = 0;
-    while (1) {
-      __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_10, &__pyx_t_9, NULL, &__pyx_t_1, NULL, __pyx_t_11);
-      if (unlikely(__pyx_t_12 == 0)) break;
-      if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+      __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0;
+      __pyx_t_6 = NULL;
+    } else {
+      __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
+    }
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    for (;;) {
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) {
+        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break;
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
+        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++;
+      } else {
+        __pyx_t_1 = __pyx_t_6(__pyx_t_2);
+        if (unlikely(!__pyx_t_1)) {
+          if (PyErr_Occurred()) {
+            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          break;
+        }
+        __Pyx_GOTREF(__pyx_t_1);
+      }
       __Pyx_XDECREF(__pyx_v_f);
       __pyx_v_f = __pyx_t_1;
       __pyx_t_1 = 0;
@@ -11780,37 +11648,39 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
       __Pyx_INCREF(__pyx_v_f);
       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
-      __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-      __pyx_t_14 = PyObject_RichCompare(__pyx_v_label, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__filter), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-      __pyx_t_14 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_14);
+      __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
+      __pyx_t_11 = __Pyx_PyString_Equals(__pyx_v_label, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_12 = __Pyx_PyBool_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__filter), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_13);
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_INCREF(__pyx_v_label);
-      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_label);
+      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_label);
       __Pyx_GIVEREF(__pyx_v_label);
-      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
-      __Pyx_GIVEREF(__pyx_t_14);
-      __pyx_t_14 = 0;
-      __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_84), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
-      __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 = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_13);
-      PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_14));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
-      __pyx_t_14 = 0;
-      __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_14);
+      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12);
+      __Pyx_GIVEREF(__pyx_t_12);
+      __pyx_t_12 = 0;
+      __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_84), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_12));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
+      __pyx_t_12 = 0;
+      __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
     }
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   }
@@ -11824,8 +11694,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_18write_header(CYTHON_UNUSED PyObjec
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("pysam.cvcf.VCF.write_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -11845,11 +11715,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_21parse_heading = {__Pyx_NAMESTR
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_heading (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -11863,10 +11734,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_21parse_heading(PyObject *__pyx_self
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_heading", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -12086,18 +11959,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObje
   for (;;) {
     if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++;
     } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++;
     } else {
       __pyx_t_7 = __pyx_t_8(__pyx_t_1);
       if (unlikely(!__pyx_t_7)) {
@@ -12131,14 +11996,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObje
     __pyx_t_9 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     if (!__pyx_t_6) {
       __pyx_t_10 = PyObject_GetItem(__pyx_v_headings, __pyx_v_i); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_10, __pyx_v_s, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_10, __pyx_v_s, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -12158,7 +12025,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObje
       __pyx_t_9 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_10 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -12307,18 +12175,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObje
   for (;;) {
     if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_11)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_11)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_10 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
     } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_11)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_10 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
     } else {
       __pyx_t_10 = __pyx_t_8(__pyx_t_11);
       if (unlikely(!__pyx_t_10)) {
@@ -12351,7 +12211,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_20parse_heading(CYTHON_UNUSED PyObje
     PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
     __pyx_t_10 = 0;
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
   }
   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
@@ -12396,11 +12256,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_23write_heading = {__Pyx_NAMESTR
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_23write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write_heading (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -12414,10 +12275,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_23write_heading(PyObject *__pyx_self
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write_heading", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -12535,11 +12398,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_25convertGT = {__Pyx_NAMESTR("co
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_GTstring = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTstring,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("convertGT (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTstring,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -12553,10 +12417,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_25convertGT(PyObject *__pyx_self, Py
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTstring)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTstring);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("convertGT", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -12598,8 +12464,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
   PyObject *__pyx_v_gts = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
@@ -12626,18 +12492,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
  *         try:
  *             gts = gtsRegEx.split(GTstring)
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_GTstring, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_1 = __Pyx_PyString_Equals(__pyx_v_GTstring, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_1) {
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
-    PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_9));
+    PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
     __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
-    __pyx_r = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_r = ((PyObject *)__pyx_t_2);
+    __pyx_t_2 = 0;
     goto __pyx_L0;
     goto __pyx_L3;
   }
@@ -12664,20 +12528,20 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
  *             if len(gts) == 1: return [int(gts[0])]
  *             if len(gts) != 2: raise ValueError()
  */
-      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gtsRegEx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gtsRegEx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __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 = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __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 = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_GTstring);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_GTstring);
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_GTstring);
       __Pyx_GIVEREF(__pyx_v_GTstring);
-      __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __pyx_v_gts = __pyx_t_7;
       __pyx_t_7 = 0;
 
@@ -12689,26 +12553,26 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
  *             if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]]
  */
       __pyx_t_8 = PyObject_Length(__pyx_v_gts); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __pyx_t_2 = (__pyx_t_8 == 1);
-      if (__pyx_t_2) {
+      __pyx_t_1 = (__pyx_t_8 == 1);
+      if (__pyx_t_1) {
         __Pyx_XDECREF(__pyx_r);
         __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         __pyx_t_7 = 0;
-        __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-        __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         __pyx_t_7 = 0;
-        __pyx_r = ((PyObject *)__pyx_t_1);
-        __pyx_t_1 = 0;
+        __pyx_r = ((PyObject *)__pyx_t_2);
+        __pyx_t_2 = 0;
         goto __pyx_L8_try_return;
         goto __pyx_L12;
       }
@@ -12722,12 +12586,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
  *             return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]
  */
       __pyx_t_8 = PyObject_Length(__pyx_v_gts); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __pyx_t_2 = (__pyx_t_8 != 2);
-      if (__pyx_t_2) {
-        __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = (__pyx_t_8 != 2);
+      if (__pyx_t_1) {
+        __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L4_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 = 589; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         goto __pyx_L13;
       }
@@ -12740,27 +12604,23 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
  *             return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])]
  *         except ValueError:
  */
-      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (__pyx_t_2) {
-        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      if (__pyx_t_1) {
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_9 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __pyx_t_10 = __pyx_t_9;
       } else {
-        __pyx_t_10 = __pyx_t_2;
+        __pyx_t_10 = __pyx_t_1;
       }
       if (__pyx_t_10) {
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_8 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
@@ -12775,13 +12635,13 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_12 = PyList_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_12);
-        PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
         PyList_SET_ITEM(__pyx_t_12, 1, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
         PyList_SET_ITEM(__pyx_t_12, 2, __pyx_t_6);
         __Pyx_GIVEREF(__pyx_t_6);
-        __pyx_t_1 = 0;
+        __pyx_t_2 = 0;
         __pyx_t_7 = 0;
         __pyx_t_6 = 0;
         __pyx_r = ((PyObject *)__pyx_t_12);
@@ -12821,27 +12681,27 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
       __Pyx_GOTREF(__pyx_t_6);
       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-      __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_12);
       __Pyx_GIVEREF(__pyx_t_12);
-      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
+      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
       __Pyx_GIVEREF(__pyx_t_6);
-      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_7);
+      PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __pyx_t_12 = 0;
       __pyx_t_6 = 0;
       __pyx_t_7 = 0;
-      __pyx_r = ((PyObject *)__pyx_t_1);
-      __pyx_t_1 = 0;
+      __pyx_r = ((PyObject *)__pyx_t_2);
+      __pyx_t_2 = 0;
       goto __pyx_L8_try_return;
     }
     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -12858,7 +12718,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
     /* "pysam/cvcf.pyx":592
  *             if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]]
@@ -12870,8 +12730,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
     __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
     if (__pyx_t_13) {
       __Pyx_AddTraceback("pysam.cvcf.VCF.convertGT", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_GOTREF(__pyx_t_6);
 
@@ -12926,11 +12786,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
       __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
       __pyx_r = ((PyObject *)__pyx_t_15);
       __pyx_t_15 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L7_except_return;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L5_exception_handled;
@@ -12958,7 +12818,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_24convertGT(CYTHON_UNUSED PyObject *
   __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_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_12);
@@ -12980,11 +12840,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_27convertGTback = {__Pyx_NAMESTR
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_GTdata = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTdata,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("convertGTback (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTdata,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -12998,10 +12859,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_27convertGTback(PyObject *__pyx_self
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTdata)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTdata);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("convertGTback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -13107,11 +12970,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_29parse_formatdata(PyObject *__pyx_s
   PyObject *__pyx_v_value = 0;
   PyObject *__pyx_v_formatdict = 0;
   PyObject *__pyx_v_line = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__formatdict,&__pyx_n_s__line,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_formatdata (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__formatdict,&__pyx_n_s__line,0};
     PyObject* values[5] = {0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -13128,25 +12992,30 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_29parse_formatdata(PyObject *__pyx_s
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict)) != 0)) kw_args--;
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict);
+        if (likely(values[3])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  4:
-        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[4])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -13252,7 +13121,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *             self._add_definition(formatdict, key, value, line )
  *             f = formatdict[key]
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (__pyx_t_4) {
@@ -13311,10 +13181,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  */
   __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_4) {
 
     /* "pysam/cvcf.pyx":606
@@ -13326,23 +13194,23 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  */
     __pyx_t_4 = (__pyx_v_value != Py_None);
     if (__pyx_t_4) {
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_96); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_96); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __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 = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
-      __Pyx_GIVEREF(__pyx_t_1);
-      __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -13355,10 +13223,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *         # deal with trailing data in some early VCF files
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_r = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_r = ((PyObject *)__pyx_t_2);
+    __pyx_t_2 = 0;
     goto __pyx_L0;
     goto __pyx_L4;
   }
@@ -13371,11 +13239,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *         # deal with trailing data in some early VCF files
  *         if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__split); 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_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_values = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -13388,13 +13256,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  */
   __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Float), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!((int)__pyx_t_4)) {
-    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Integer), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_6 = ((int)__pyx_t_5);
   } else {
     __pyx_t_6 = ((int)__pyx_t_4);
@@ -13407,16 +13271,17 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
     if (__pyx_t_6) {
       __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_int_neg_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_neg_1, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_8 = __pyx_t_5;
     } else {
       __pyx_t_8 = __pyx_t_6;
@@ -13434,12 +13299,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *             values[-1] = values[-1].split(';')[0]
  *         if f.type == "Integer":
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_TRAILING_DATA); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __Pyx_INCREF(__pyx_v_line);
@@ -13447,15 +13312,15 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
     __Pyx_GIVEREF(__pyx_v_line);
     PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
     __Pyx_GIVEREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
+    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
     __pyx_t_3 = 0;
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
     /* "pysam/cvcf.pyx":612
  *         if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1:
@@ -13464,17 +13329,17 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *         if f.type == "Integer":
  *             for idx,v in enumerate(values):
  */
-    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __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_9, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (__Pyx_SetItemInt(__pyx_v_values, -1, __pyx_t_9, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     goto __pyx_L6;
@@ -13490,10 +13355,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  */
   __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__Integer), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_6) {
 
     /* "pysam/cvcf.pyx":614
@@ -13504,53 +13367,45 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *                     if v == ".": values[idx] = f.missingvalue
  */
     __Pyx_INCREF(__pyx_int_0);
-    __pyx_t_2 = __pyx_int_0;
+    __pyx_t_9 = __pyx_int_0;
     if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
-      __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = 0;
+      __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
       __pyx_t_10 = NULL;
     } else {
-      __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
+      __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_9)) {
-        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_9)) {
-        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_1)) {
+        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
+      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_1)) {
+        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
       } else {
-        __pyx_t_1 = __pyx_t_10(__pyx_t_9);
-        if (unlikely(!__pyx_t_1)) {
+        __pyx_t_2 = __pyx_t_10(__pyx_t_1);
+        if (unlikely(!__pyx_t_2)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_2);
       }
       __Pyx_XDECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_1;
-      __pyx_t_1 = 0;
-      __Pyx_INCREF(__pyx_t_2);
+      __pyx_v_v = __pyx_t_2;
+      __pyx_t_2 = 0;
+      __Pyx_INCREF(__pyx_t_9);
       __Pyx_XDECREF(__pyx_v_idx);
-      __pyx_v_idx = __pyx_t_2;
-      __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2);
-      __pyx_t_2 = __pyx_t_1;
-      __pyx_t_1 = 0;
-
+      __pyx_v_idx = __pyx_t_9;
+      __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_9);
+      __pyx_t_9 = __pyx_t_2;
+      __pyx_t_2 = 0;
+
       /* "pysam/cvcf.pyx":615
  *         if f.type == "Integer":
  *             for idx,v in enumerate(values):
@@ -13572,14 +13427,12 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *                     else:        values[idx] = int(v)
  *                 except:
  */
-          __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+          __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
           if (__pyx_t_6) {
-            __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_GOTREF(__pyx_t_1);
-            if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+            __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __Pyx_GOTREF(__pyx_t_2);
+            if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
             goto __pyx_L18;
           }
           /*else*/ {
@@ -13591,14 +13444,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *                 except:
  *                     self.error(line,self.ERROR_FORMAT_NOT_INTEGER,"%s=%s" % (key, str(values)))
  */
-            __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
-            __Pyx_GOTREF(__pyx_t_1);
+            __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __Pyx_GOTREF(__pyx_t_2);
             __Pyx_INCREF(__pyx_v_v);
-            PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v);
+            PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_v);
             __Pyx_GIVEREF(__pyx_v_v);
-            __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
+            __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L10_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;
             if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
           }
@@ -13609,7 +13462,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
         __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
         goto __pyx_L17_try_end;
         __pyx_L10_error:;
-        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
         /* "pysam/cvcf.pyx":618
@@ -13621,9 +13474,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  */
         /*except:*/ {
           __Pyx_AddTraceback("pysam.cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
-          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
+          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
           __Pyx_GOTREF(__pyx_t_3);
-          __Pyx_GOTREF(__pyx_t_1);
+          __Pyx_GOTREF(__pyx_t_2);
           __Pyx_GOTREF(__pyx_t_14);
 
           /* "pysam/cvcf.pyx":619
@@ -13700,7 +13553,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
           __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
           goto __pyx_L13_except_return;
           __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;
           __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
           goto __pyx_L11_exception_handled;
         }
@@ -13724,8 +13577,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
         __pyx_L17_try_end:;
       }
     }
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
     /* "pysam/cvcf.pyx":621
  *                     self.error(line,self.ERROR_FORMAT_NOT_INTEGER,"%s=%s" % (key, str(values)))
@@ -13748,11 +13601,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *             self._line = line
  *             if f.id == "GT": values = list(map( self.convertGT, values ))
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__String), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_6) {
 
@@ -13774,35 +13625,33 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  */
     __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__GT), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__GT), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (__pyx_t_6) {
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__convertGT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__convertGT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
+      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
+      __Pyx_GIVEREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_v_values);
-      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_values);
+      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_values);
       __Pyx_GIVEREF(__pyx_v_values);
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = 0;
+      __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
+      __Pyx_GIVEREF(__pyx_t_9);
+      __pyx_t_9 = 0;
+      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_v_values);
-      __pyx_v_values = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_values = __pyx_t_9;
+      __pyx_t_9 = 0;
       goto __pyx_L21;
     }
     __pyx_L21:;
@@ -13828,11 +13677,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *             for v in values:
  *                 if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR)
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__Character), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_6) {
 
@@ -13854,32 +13701,24 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
     for (;;) {
       if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_9)) {
         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++;
       } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_9)) {
         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++;
       } else {
-        __pyx_t_2 = __pyx_t_10(__pyx_t_9);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_1 = __pyx_t_10(__pyx_t_9);
+        if (unlikely(!__pyx_t_1)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_1);
       }
       __Pyx_XDECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_v = __pyx_t_1;
+      __pyx_t_1 = 0;
 
       /* "pysam/cvcf.pyx":628
  *         elif f.type == "Character":
@@ -13891,22 +13730,22 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
       __pyx_t_19 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_6 = (__pyx_t_19 != 1);
       if (__pyx_t_6) {
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_14 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_101); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_14);
-        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __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 = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_14);
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_14);
         __Pyx_GIVEREF(__pyx_t_14);
         __pyx_t_14 = 0;
-        __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_14);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
         goto __pyx_L24;
       }
@@ -13937,10 +13776,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  */
   __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_14 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__Float), Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   if (__pyx_t_6) {
 
     /* "pysam/cvcf.pyx":631
@@ -13951,52 +13788,44 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *             try: return list(map(float,values))
  */
     __Pyx_INCREF(__pyx_int_0);
-    __pyx_t_14 = __pyx_int_0;
+    __pyx_t_9 = __pyx_int_0;
     if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
-      __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = 0;
+      __pyx_t_14 = __pyx_v_values; __Pyx_INCREF(__pyx_t_14); __pyx_t_7 = 0;
       __pyx_t_10 = NULL;
     } else {
-      __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
+      __pyx_t_7 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_14);
+      __pyx_t_10 = Py_TYPE(__pyx_t_14)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_9)) {
-        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_9)) {
-        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_14)) {
+        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_14)) break;
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
+      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_14)) {
+        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++;
       } else {
-        __pyx_t_1 = __pyx_t_10(__pyx_t_9);
-        if (unlikely(!__pyx_t_1)) {
+        __pyx_t_2 = __pyx_t_10(__pyx_t_14);
+        if (unlikely(!__pyx_t_2)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_2);
       }
       __Pyx_XDECREF(__pyx_v_v);
-      __pyx_v_v = __pyx_t_1;
-      __pyx_t_1 = 0;
-      __Pyx_INCREF(__pyx_t_14);
+      __pyx_v_v = __pyx_t_2;
+      __pyx_t_2 = 0;
+      __Pyx_INCREF(__pyx_t_9);
       __Pyx_XDECREF(__pyx_v_idx);
-      __pyx_v_idx = __pyx_t_14;
-      __pyx_t_1 = PyNumber_Add(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_14);
-      __pyx_t_14 = __pyx_t_1;
-      __pyx_t_1 = 0;
+      __pyx_v_idx = __pyx_t_9;
+      __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_9);
+      __pyx_t_9 = __pyx_t_2;
+      __pyx_t_2 = 0;
 
       /* "pysam/cvcf.pyx":632
  *         elif f.type == "Float":
@@ -14005,20 +13834,18 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *             try: return list(map(float,values))
  *             except:
  */
-      __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __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 = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_6) {
-        __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         goto __pyx_L27;
       }
       __pyx_L27:;
     }
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
     /* "pysam/cvcf.pyx":633
  *             for idx,v in enumerate(values):
@@ -14034,27 +13861,27 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
       __Pyx_XGOTREF(__pyx_t_11);
       /*try:*/ {
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
-        __Pyx_GOTREF(__pyx_t_14);
+        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_INCREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
-        PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)((PyObject*)(&PyFloat_Type))));
+        PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)(&PyFloat_Type))));
         __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
         __Pyx_INCREF(__pyx_v_values);
-        PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_values);
+        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_values);
         __Pyx_GIVEREF(__pyx_v_values);
-        __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(((PyObject *)__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 = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
+        __pyx_t_14 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
         __Pyx_GOTREF(__pyx_t_14);
-        PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9);
-        __Pyx_GIVEREF(__pyx_t_9);
-        __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
+        __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 = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
-        __pyx_r = __pyx_t_9;
-        __pyx_t_9 = 0;
+        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_14);
+        __Pyx_GIVEREF(__pyx_t_14);
+        __pyx_t_14 = 0;
+        __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
+        __Pyx_GOTREF(__pyx_t_14);
+        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+        __pyx_r = __pyx_t_14;
+        __pyx_t_14 = 0;
         goto __pyx_L32_try_return;
       }
       __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
@@ -14073,10 +13900,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
       __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
       __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
 
       /* "pysam/cvcf.pyx":634
  *                 if v == ".": values[idx] = f.missingvalue
@@ -14087,10 +13914,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  */
       /*except:*/ {
         __Pyx_AddTraceback("pysam.cvcf.VCF.parse_formatdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_14, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_9, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_14);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_2);
 
         /* "pysam/cvcf.pyx":635
  *             try: return list(map(float,values))
@@ -14099,8 +13926,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  *                 return [0.0] * len(values)
  *         else:
  */
-        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
@@ -14133,9 +13960,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
         __Pyx_GIVEREF(((PyObject *)__pyx_t_17));
         __pyx_t_3 = 0;
         __pyx_t_17 = 0;
-        __pyx_t_17 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
+        __pyx_t_17 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_17);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
         __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
 
@@ -14162,13 +13989,13 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
         __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
         __pyx_r = ((PyObject *)__pyx_t_18);
         __pyx_t_18 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
         goto __pyx_L31_except_return;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         goto __pyx_L29_exception_handled;
       }
       __pyx_L30_except_error:;
@@ -14201,23 +14028,23 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_28parse_formatdata(CYTHON_UNUSED PyO
  * 
  *     def inregion(self, chrom, pos):
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_14 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_14);
-    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_14);
     __Pyx_INCREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_line);
     __Pyx_GIVEREF(__pyx_v_line);
-    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_14);
-    __Pyx_GIVEREF(__pyx_t_14);
-    __pyx_t_14 = 0;
-    __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_14);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_9);
+    __Pyx_GIVEREF(__pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __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_14)); __pyx_t_14 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   }
   __pyx_L7:;
 
@@ -14252,11 +14079,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyO
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_chrom = 0;
   PyObject *__pyx_v_pos = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__chrom,&__pyx_n_s__pos,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("inregion (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__chrom,&__pyx_n_s__pos,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -14271,15 +14099,18 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_31inregion(PyObject *__pyx_self, PyO
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("inregion", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("inregion", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -14381,18 +14212,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *_
   for (;;) {
     if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
       if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
     } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
       if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
     } else {
       __pyx_t_1 = __pyx_t_6(__pyx_t_4);
       if (unlikely(!__pyx_t_1)) {
@@ -14417,19 +14240,22 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_30inregion(CYTHON_UNUSED PyObject *_
  */
     __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_r, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_v_chrom, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_v_chrom, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     if (__pyx_t_3) {
       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_r, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_v_pos, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_v_pos, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
         __Pyx_DECREF(__pyx_t_1);
         __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_r, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos, __pyx_t_8, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       }
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -14528,11 +14354,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_33parse_data(PyObject *__pyx_self, P
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_lineparse = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__lineparse,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse_data (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__lineparse,0};
     PyObject* values[3] = {0,0,0};
     __pyx_defaults4 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self);
     values[2] = __pyx_dynamic_args->__pyx_arg_lineparse;
@@ -14549,10 +14376,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_33parse_data(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse_data", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -14668,18 +14497,10 @@ static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_10parse_data_2generator1(__pyx_Gener
   for (;;) {
     if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
     } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
     } else {
       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
       if (unlikely(!__pyx_t_4)) {
@@ -14734,7 +14555,6 @@ static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_10parse_data_2generator1(__pyx_Gener
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_r);
   __pyx_generator->resume_label = -1;
-  __Pyx_Generator_clear((PyObject*)__pyx_generator);
   __Pyx_RefNannyFinishContext();
   return NULL;
 }
@@ -15077,7 +14897,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *         # implement filtering
  */
   if (unlikely(!__pyx_v_pos)) { __Pyx_RaiseUnboundLocalError("pos"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (__pyx_t_5) {
@@ -15200,9 +15021,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             self.error(line,self.MISSING_REF)
  *             if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference)
  */
-  __pyx_t_2 = PyObject_RichCompare(__pyx_v_ref, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_14 = __Pyx_PyString_Equals(__pyx_v_ref, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__pyx_t_14) {
 
     /* "pysam/cvcf.pyx":676
@@ -15239,7 +15058,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
     __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_9 = PyObject_RichCompare(__pyx_t_10, __pyx_int_33, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_RichCompare(__pyx_t_10, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
@@ -15309,18 +15129,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
     for (;;) {
       if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
       } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
       } else {
         __pyx_t_8 = __pyx_t_15(__pyx_t_2);
         if (unlikely(!__pyx_t_8)) {
@@ -15343,7 +15155,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference)
  * 
  */
-      __pyx_t_14 = (__Pyx_PySequence_Contains(__pyx_v_c, ((PyObject *)__pyx_n_s__ACGTN), Py_NE)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_14 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_n_s__ACGTN), __pyx_v_c))); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (__pyx_t_14) {
         __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -15375,7 +15187,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *         # make sure reference is sane
  */
-    __pyx_t_14 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__N), __pyx_v_ref, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = ((PySequence_Contains(__pyx_v_ref, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_14) {
       __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
@@ -15439,7 +15251,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
     __pyx_t_16 = 0;
     __pyx_t_2 = PyInt_FromLong(__pyx_t_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -15453,11 +15266,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
       __pyx_t_10 = 0;
     }
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = __pyx_t_8;
-    __Pyx_INCREF(__pyx_t_9);
+    __Pyx_INCREF(__pyx_t_8);
+    __pyx_v_left = __pyx_t_8;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_v_left = __pyx_t_9;
-    __pyx_t_9 = 0;
 
     /* "pysam/cvcf.pyx":687
  *         if self._reference:
@@ -15466,16 +15277,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             faref = faref_leftflank[pos-left:]
  *             if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
  */
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_10 = PyNumber_Add(__pyx_v_pos, __pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_10 = PyNumber_Add(__pyx_v_pos, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_INCREF(__pyx_v_chrom);
@@ -15486,16 +15297,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
     __Pyx_GIVEREF(__pyx_v_left);
     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
-    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_8);
-    __Pyx_GIVEREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_9);
+    __Pyx_GIVEREF(__pyx_t_9);
     __pyx_t_10 = 0;
-    __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = 0;
+    __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_v_faref_leftflank = __pyx_t_8;
-    __pyx_t_8 = 0;
+    __pyx_v_faref_leftflank = __pyx_t_9;
+    __pyx_t_9 = 0;
 
     /* "pysam/cvcf.pyx":688
  *             left = max(0,pos-100)
@@ -15504,14 +15315,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref))
  *             ref = faref
  */
-    __pyx_t_8 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_v_faref = __pyx_t_8;
-    __pyx_t_8 = 0;
+    __pyx_t_9 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_v_faref = __pyx_t_9;
+    __pyx_t_9 = 0;
 
     /* "pysam/cvcf.pyx":689
  *             faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference)
@@ -15520,40 +15331,41 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             ref = faref
  * 
  */
-    __pyx_t_8 = PyObject_RichCompare(__pyx_v_faref, __pyx_v_ref, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_9 = PyObject_RichCompare(__pyx_v_faref, __pyx_v_ref, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     if (__pyx_t_14) {
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__WRONG_REF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __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 = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_faref);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_faref);
+      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_faref);
       __Pyx_GIVEREF(__pyx_v_faref);
       __Pyx_INCREF(__pyx_v_ref);
-      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_ref);
+      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_ref);
       __Pyx_GIVEREF(__pyx_v_ref);
-      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_106), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_106), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __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 = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
       __Pyx_GIVEREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_t_10));
+      PyTuple_SET_ITEM(__pyx_t_8, 2, ((PyObject *)__pyx_t_10));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
       __pyx_t_2 = 0;
       __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       goto __pyx_L25;
     }
@@ -15582,16 +15394,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
   __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_9 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_14) {
-    __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
-    __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_9);
-    __pyx_t_9 = 0;
+    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
+    __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_10);
+    __pyx_t_10 = 0;
     goto __pyx_L26;
   }
   /*else*/ {
@@ -15603,23 +15413,23 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *         if cols[5] == ".": qual = -1
  */
-    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__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_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); 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_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_107), NULL); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __Pyx_GIVEREF(__pyx_t_9);
-    __pyx_cur_scope->__pyx_v_alt = __pyx_t_9;
-    __pyx_t_9 = 0;
+    __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_GIVEREF(__pyx_t_10);
+    __pyx_cur_scope->__pyx_v_alt = __pyx_t_10;
+    __pyx_t_10 = 0;
   }
   __pyx_L26:;
 
@@ -15630,11 +15440,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *         else:
  *             try:    qual = float(cols[5])
  */
-  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_14 = __Pyx_PyString_Equals(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   if (__pyx_t_14) {
     __pyx_v_qual = -1.0;
@@ -15670,8 +15478,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
 
       /* "pysam/cvcf.pyx":699
@@ -15683,10 +15491,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
       /*except:*/ {
         __Pyx_AddTraceback("pysam.cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
+        if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_GOTREF(__pyx_t_9);
         __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__QUAL_NOT_NUMERICAL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L30_except_error;}
@@ -15705,8 +15513,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         goto __pyx_L29_exception_handled;
       }
       __pyx_L30_except_error:;
@@ -15732,25 +15540,19 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *         else: filter = cols[6].split(';')
  * 
  */
-  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_kp_s_9), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_14 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (!__pyx_t_14) {
     __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__PASS), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_n_s__PASS), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     if (!__pyx_t_5) {
-      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_kp_s__0), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_18 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_kp_s__0), Py_EQ); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_t_19 = __pyx_t_18;
     } else {
@@ -15810,10 +15612,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
   __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_kp_s_9), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_kp_s_9), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   if (__pyx_t_5) {
 
     /* "pysam/cvcf.pyx":708
@@ -15823,52 +15623,44 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 elts = blurp.split('=')
  *                 if len(elts) == 1: v = None
  */
-    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
-      __pyx_t_9 = __pyx_t_8; __Pyx_INCREF(__pyx_t_9); __pyx_t_4 = 0;
+    __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
+      __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_15 = Py_TYPE(__pyx_t_9)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_9)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_8 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_9)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_8 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++;
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++;
       } else {
-        __pyx_t_8 = __pyx_t_15(__pyx_t_9);
-        if (unlikely(!__pyx_t_8)) {
+        __pyx_t_9 = __pyx_t_15(__pyx_t_8);
+        if (unlikely(!__pyx_t_9)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_GOTREF(__pyx_t_9);
       }
       __Pyx_XDECREF(__pyx_v_blurp);
-      __pyx_v_blurp = __pyx_t_8;
-      __pyx_t_8 = 0;
+      __pyx_v_blurp = __pyx_t_9;
+      __pyx_t_9 = 0;
 
       /* "pysam/cvcf.pyx":709
  *         if cols[7] != ".":
@@ -15877,11 +15669,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 if len(elts) == 1: v = None
  *                 elif len(elts) == 2: v = elts[1]
  */
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_XDECREF(__pyx_v_elts);
       __pyx_v_elts = __pyx_t_10;
       __pyx_t_10 = 0;
@@ -15930,21 +15722,21 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
         __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); 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_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_INCREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
-        __Pyx_GIVEREF(__pyx_t_8);
-        __pyx_t_8 = 0;
-        __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); 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);
+        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
+        __Pyx_GIVEREF(__pyx_t_9);
+        __pyx_t_9 = 0;
+        __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       }
       __pyx_L42:;
 
@@ -15955,8 +15747,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                                                       v,
  *                                                       self._info,
  */
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); 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_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
 
@@ -16000,9 +15792,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
       __Pyx_GIVEREF(__pyx_v_line);
       __pyx_t_7 = 0;
       __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
       /* "pysam/cvcf.pyx":713
@@ -16018,7 +15810,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     }
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L39;
   }
   __pyx_L39:;
@@ -16030,17 +15822,15 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *         else: format = cols[8].split(':')
  * 
  */
-  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_kp_s_1), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_8, ((PyObject *)__pyx_kp_s_1), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   if (__pyx_t_5) {
-    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __pyx_v_format = ((PyObject *)__pyx_t_10);
-    __pyx_t_10 = 0;
+    __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_v_format = ((PyObject *)__pyx_t_8);
+    __pyx_t_8 = 0;
     goto __pyx_L43;
   }
   /*else*/ {
@@ -16052,16 +15842,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *         # check: all filters are defined
  */
-    __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_10 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_v_format = __pyx_t_10;
-    __pyx_t_10 = 0;
+    __pyx_v_format = __pyx_t_8;
+    __pyx_t_8 = 0;
   }
   __pyx_L43:;
 
@@ -16073,42 +15863,34 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  */
   if (PyList_CheckExact(__pyx_v_filter) || PyTuple_CheckExact(__pyx_v_filter)) {
-    __pyx_t_10 = __pyx_v_filter; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0;
+    __pyx_t_8 = __pyx_v_filter; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
     __pyx_t_15 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_v_filter); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
+    __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_filter); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_10)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_9 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_10)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_9 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
+      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
     } else {
-      __pyx_t_9 = __pyx_t_15(__pyx_t_10);
-      if (unlikely(!__pyx_t_9)) {
+      __pyx_t_10 = __pyx_t_15(__pyx_t_8);
+      if (unlikely(!__pyx_t_10)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_GOTREF(__pyx_t_10);
     }
     __Pyx_XDECREF(__pyx_v_f);
-    __pyx_v_f = __pyx_t_9;
-    __pyx_t_9 = 0;
+    __pyx_v_f = __pyx_t_10;
+    __pyx_t_10 = 0;
 
     /* "pysam/cvcf.pyx":724
  *         # check: all filters are defined
@@ -16117,36 +15899,36 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *         # check: format fields are defined
  */
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_v_f, __pyx_t_9, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_10, __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     if (__pyx_t_5) {
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FILTER_NOT_DEFINED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
       __Pyx_GIVEREF(__pyx_t_1);
       __Pyx_INCREF(__pyx_v_f);
-      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_f);
+      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_f);
       __Pyx_GIVEREF(__pyx_v_f);
       __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       goto __pyx_L46;
     }
     __pyx_L46:;
   }
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
   /* "pysam/cvcf.pyx":727
  * 
@@ -16155,10 +15937,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             for f in format:
  *                 if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f)
  */
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   if (__pyx_t_5) {
 
     /* "pysam/cvcf.pyx":728
@@ -16169,30 +15951,22 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  */
     if (PyList_CheckExact(__pyx_v_format) || PyTuple_CheckExact(__pyx_v_format)) {
-      __pyx_t_10 = __pyx_v_format; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0;
+      __pyx_t_8 = __pyx_v_format; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_v_format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_10)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_10)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
       } else {
-        __pyx_t_1 = __pyx_t_15(__pyx_t_10);
+        __pyx_t_1 = __pyx_t_15(__pyx_t_8);
         if (unlikely(!__pyx_t_1)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -16215,34 +15989,34 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
       __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_v_f, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_1, __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       if (__pyx_t_5) {
         __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
-        __Pyx_GIVEREF(__pyx_t_8);
+        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
+        __Pyx_GIVEREF(__pyx_t_9);
         __Pyx_INCREF(__pyx_v_f);
-        PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_f);
+        PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_f);
         __Pyx_GIVEREF(__pyx_v_f);
-        __pyx_t_8 = 0;
-        __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __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 = 729; __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_9)); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         goto __pyx_L50;
       }
       __pyx_L50:;
     }
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L47;
   }
   __pyx_L47:;
@@ -16254,12 +16028,13 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)
  *             newalts = []
  */
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_8 = PyObject_RichCompare(__pyx_t_10, __pyx_int_33, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (__pyx_t_5) {
 
     /* "pysam/cvcf.pyx":733
@@ -16272,23 +16047,23 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
     __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_5 = (__pyx_t_4 != 1);
     if (__pyx_t_5) {
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __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 = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
-      __Pyx_GIVEREF(__pyx_t_10);
-      __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       goto __pyx_L52;
     }
     __pyx_L52:;
@@ -16300,10 +16075,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             have_deletions = False
  *             for a in alt:
  */
-    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __pyx_v_newalts = __pyx_t_10;
-    __pyx_t_10 = 0;
+    __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_v_newalts = __pyx_t_8;
+    __pyx_t_8 = 0;
 
     /* "pysam/cvcf.pyx":735
  *             if len(ref) != 1: self.error(line,self.V33_BAD_REF)
@@ -16322,42 +16097,34 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:]  # insertion just beyond pos; add first and trailing reference
  */
     if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-      __pyx_t_10 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0;
+      __pyx_t_8 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_10)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_9 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_10)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_9 = PySequence_ITEM(__pyx_t_10, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
       } else {
-        __pyx_t_9 = __pyx_t_15(__pyx_t_10);
-        if (unlikely(!__pyx_t_9)) {
+        __pyx_t_10 = __pyx_t_15(__pyx_t_8);
+        if (unlikely(!__pyx_t_10)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_10);
       }
       __Pyx_XDECREF(__pyx_v_a);
-      __pyx_v_a = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_v_a = __pyx_t_10;
+      __pyx_t_10 = 0;
 
       /* "pysam/cvcf.pyx":737
  *             have_deletions = False
@@ -16369,14 +16136,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
       __pyx_t_3 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_5 = (__pyx_t_3 == 1);
       if (__pyx_t_5) {
-        __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_9 = PyNumber_Add(__pyx_v_a, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_8 = PyNumber_Add(__pyx_v_a, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_v_a);
-        __pyx_v_a = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_v_a = __pyx_t_9;
+        __pyx_t_9 = 0;
         goto __pyx_L55;
       }
 
@@ -16387,31 +16154,31 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 elif a.startswith('D'): # allow D<seq> and D<num>
  *                     have_deletions = True
  */
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_5) {
-        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __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;
         __Pyx_DECREF(__pyx_v_a);
-        __pyx_v_a = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_a = __pyx_t_10;
+        __pyx_t_10 = 0;
         goto __pyx_L55;
       }
 
@@ -16422,13 +16189,13 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     have_deletions = True
  *                     try:
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       if (__pyx_t_5) {
 
         /* "pysam/cvcf.pyx":740
@@ -16461,19 +16228,19 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                         if len(ref) < l:        # add to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference)
  */
-            __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_GOTREF(__pyx_t_8);
-            __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
             __Pyx_GOTREF(__pyx_t_9);
-            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
-            __Pyx_GIVEREF(__pyx_t_8);
-            __pyx_t_8 = 0;
-            __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_GOTREF(__pyx_t_8);
-            __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+            __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_GOTREF(__pyx_t_10);
+            PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
+            __Pyx_GIVEREF(__pyx_t_9);
+            __pyx_t_9 = 0;
+            __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_GOTREF(__pyx_t_9);
+            __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
             __Pyx_XDECREF(__pyx_v_l);
-            __pyx_v_l = __pyx_t_8;
-            __pyx_t_8 = 0;
+            __pyx_v_l = __pyx_t_9;
+            __pyx_t_9 = 0;
 
             /* "pysam/cvcf.pyx":743
  *                     try:
@@ -16483,12 +16250,13 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                             ref += addns
  */
             __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_GOTREF(__pyx_t_8);
-            __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_v_l, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-            __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_GOTREF(__pyx_t_9);
+            __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_v_l, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_GOTREF(__pyx_t_10);
             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+            __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
             if (__pyx_t_5) {
 
               /* "pysam/cvcf.pyx":744
@@ -16498,16 +16266,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                             ref += addns
  *                             for i,na in enumerate(newalts): newalts[i] = na+addns
  */
-              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __Pyx_GOTREF(__pyx_t_10);
               __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-              __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-              __Pyx_GOTREF(__pyx_t_8);
-              __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __Pyx_GOTREF(__pyx_t_9);
+              __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-              __pyx_t_8 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-              __Pyx_GOTREF(__pyx_t_8);
+              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+              __pyx_t_9 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __Pyx_GOTREF(__pyx_t_9);
               __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
               __Pyx_GOTREF(__pyx_t_7);
               __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
@@ -16517,16 +16285,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
               __Pyx_GIVEREF(__pyx_v_chrom);
               PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
-              PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8);
-              __Pyx_GIVEREF(__pyx_t_8);
+              PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
+              __Pyx_GIVEREF(__pyx_t_9);
               PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7);
               __Pyx_GIVEREF(__pyx_t_7);
               __pyx_t_1 = 0;
-              __pyx_t_8 = 0;
+              __pyx_t_9 = 0;
               __pyx_t_7 = 0;
-              __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+              __pyx_t_7 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
               __Pyx_GOTREF(__pyx_t_7);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
               __Pyx_XDECREF(__pyx_v_addns);
               __pyx_v_addns = __pyx_t_7;
@@ -16557,26 +16325,22 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
               __pyx_t_2 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
               for (;;) {
                 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
-                #if CYTHON_COMPILING_IN_CPYTHON
-                __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-                #else
-                __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-                #endif
+                __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_10); __pyx_t_3++;
                 __Pyx_XDECREF(__pyx_v_na);
-                __pyx_v_na = __pyx_t_9;
-                __pyx_t_9 = 0;
+                __pyx_v_na = __pyx_t_10;
+                __pyx_t_10 = 0;
                 __Pyx_INCREF(__pyx_t_7);
                 __Pyx_XDECREF(__pyx_v_i);
                 __pyx_v_i = __pyx_t_7;
-                __pyx_t_9 = PyNumber_Add(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-                __Pyx_GOTREF(__pyx_t_9);
+                __pyx_t_10 = PyNumber_Add(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+                __Pyx_GOTREF(__pyx_t_10);
                 __Pyx_DECREF(__pyx_t_7);
-                __pyx_t_7 = __pyx_t_9;
-                __pyx_t_9 = 0;
-                __pyx_t_9 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-                __Pyx_GOTREF(__pyx_t_9);
-                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
-                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+                __pyx_t_7 = __pyx_t_10;
+                __pyx_t_10 = 0;
+                __pyx_t_10 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+                __Pyx_GOTREF(__pyx_t_10);
+                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
+                __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
               }
               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
               __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
@@ -16605,8 +16369,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
           __pyx_L56_error:;
           __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 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;
           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -16620,10 +16384,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
           __pyx_t_20 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
           if (__pyx_t_20) {
             __Pyx_AddTraceback("pysam.cvcf.VCF.parse_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
-            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
             __Pyx_GOTREF(__pyx_t_7);
             __Pyx_GOTREF(__pyx_t_2);
-            __Pyx_GOTREF(__pyx_t_9);
+            __Pyx_GOTREF(__pyx_t_10);
 
             /* "pysam/cvcf.pyx":749
  *                         a = ref[l:]             # new deletion, deleting pos...pos+l
@@ -16632,11 +16396,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                         if len(ref) < len(s):   # add Ns to reference if necessary
  *                             addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference)
  */
-            __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-            __Pyx_GOTREF(__pyx_t_8);
+            __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+            __Pyx_GOTREF(__pyx_t_9);
             __Pyx_XDECREF(__pyx_v_s);
-            __pyx_v_s = __pyx_t_8;
-            __pyx_t_8 = 0;
+            __pyx_v_s = __pyx_t_9;
+            __pyx_t_9 = 0;
 
             /* "pysam/cvcf.pyx":750
  *                     except ValueError:
@@ -16657,8 +16421,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
  *                                 self.error(line,self.V33_UNMATCHED_DELETION,
  */
-              __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-              __Pyx_GOTREF(__pyx_t_8);
+              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+              __Pyx_GOTREF(__pyx_t_9);
               __pyx_t_21 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
               __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
               __Pyx_GOTREF(__pyx_t_1);
@@ -16687,9 +16451,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
               __pyx_t_6 = 0;
               __pyx_t_22 = 0;
               __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0;
               __Pyx_XDECREF(__pyx_v_addns);
               __pyx_v_addns = __pyx_t_1;
@@ -16709,24 +16473,22 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
               __Pyx_INCREF(__pyx_v_addns);
               PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_v_addns);
               __Pyx_GIVEREF(__pyx_v_addns);
-              __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-              __Pyx_GOTREF(__pyx_t_8);
+              __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+              __Pyx_GOTREF(__pyx_t_9);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0;
-              __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+              __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
               __pyx_t_14 = (!__pyx_t_5);
               if (__pyx_t_14) {
                 __pyx_t_21 = PyObject_Length(__pyx_v_addns); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_GOTREF(__pyx_t_8);
-                __pyx_t_23 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_8); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_GOTREF(__pyx_t_9);
+                __pyx_t_23 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_9); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
                 __Pyx_GOTREF(((PyObject *)__pyx_t_23));
-                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-                __pyx_t_8 = PyObject_RichCompare(__pyx_v_addns, ((PyObject *)__pyx_t_23), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+                __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_addns, ((PyObject *)__pyx_t_23), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
                 __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0;
-                __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                 __pyx_t_19 = __pyx_t_5;
               } else {
                 __pyx_t_19 = __pyx_t_14;
@@ -16740,10 +16502,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                                            "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference)))
  *                             ref += addns
  */
-                __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_GOTREF(__pyx_t_8);
-                __pyx_t_23 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_114); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __pyx_t_23 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
                 __Pyx_GOTREF(__pyx_t_23);
+                __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_114); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_GOTREF(__pyx_t_9);
 
                 /* "pysam/cvcf.pyx":754
  *                             if not s.endswith(addns) and addns != 'N'*len(addns):
@@ -16796,15 +16558,15 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
                 __Pyx_INCREF(__pyx_v_line);
                 PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_v_line);
                 __Pyx_GIVEREF(__pyx_v_line);
-                PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
-                __Pyx_GIVEREF(__pyx_t_23);
+                PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_9);
+                __Pyx_GIVEREF(__pyx_t_9);
                 PyTuple_SET_ITEM(__pyx_t_24, 2, ((PyObject *)__pyx_t_22));
                 __Pyx_GIVEREF(((PyObject *)__pyx_t_22));
-                __pyx_t_23 = 0;
+                __pyx_t_9 = 0;
                 __pyx_t_22 = 0;
-                __pyx_t_22 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __pyx_t_22 = PyObject_Call(__pyx_t_23, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
                 __Pyx_GOTREF(__pyx_t_22);
-                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+                __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
                 __Pyx_DECREF(((PyObject *)__pyx_t_24)); __pyx_t_24 = 0;
                 __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
                 goto __pyx_L70;
@@ -16836,26 +16598,22 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
               __pyx_t_24 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_24); __pyx_t_21 = 0;
               for (;;) {
                 if (__pyx_t_21 >= PyList_GET_SIZE(__pyx_t_24)) break;
-                #if CYTHON_COMPILING_IN_CPYTHON
-                __pyx_t_8 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_21); __Pyx_INCREF(__pyx_t_8); __pyx_t_21++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                #else
-                __pyx_t_8 = PySequence_ITEM(__pyx_t_24, __pyx_t_21); __pyx_t_21++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                #endif
+                __pyx_t_23 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_21); __Pyx_INCREF(__pyx_t_23); __pyx_t_21++;
                 __Pyx_XDECREF(__pyx_v_na);
-                __pyx_v_na = __pyx_t_8;
-                __pyx_t_8 = 0;
+                __pyx_v_na = __pyx_t_23;
+                __pyx_t_23 = 0;
                 __Pyx_INCREF(__pyx_t_22);
                 __Pyx_XDECREF(__pyx_v_i);
                 __pyx_v_i = __pyx_t_22;
-                __pyx_t_8 = PyNumber_Add(__pyx_t_22, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_GOTREF(__pyx_t_8);
+                __pyx_t_23 = PyNumber_Add(__pyx_t_22, __pyx_int_1); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_GOTREF(__pyx_t_23);
                 __Pyx_DECREF(__pyx_t_22);
-                __pyx_t_22 = __pyx_t_8;
-                __pyx_t_8 = 0;
-                __pyx_t_8 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_GOTREF(__pyx_t_8);
-                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
-                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+                __pyx_t_22 = __pyx_t_23;
+                __pyx_t_23 = 0;
+                __pyx_t_23 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_GOTREF(__pyx_t_23);
+                if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_23) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L58_except_error;}
+                __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
               }
               __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
               __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
@@ -16878,7 +16636,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
             __pyx_t_22 = 0;
             __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
             goto __pyx_L57_exception_handled;
           }
           __pyx_L58_except_error:;
@@ -16905,8 +16663,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 newalts.append(a)
  *             alt = newalts
  */
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_ALLELE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -16917,9 +16675,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
         __Pyx_GIVEREF(__pyx_t_2);
         __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
@@ -16934,7 +16692,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
       __pyx_t_25 = PyList_Append(__pyx_v_newalts, __pyx_v_a); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
     /* "pysam/cvcf.pyx":761
  *                     self.error(line,self.V33_BAD_ALLELE)
@@ -16965,9 +16723,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     # 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)
  */
-      __pyx_t_10 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_8 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       if (__pyx_t_19) {
 
         /* "pysam/cvcf.pyx":766
@@ -16977,8 +16736,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     ref += addn
  *                     alt = [allele+addn for allele in alt]
  */
-        __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
@@ -16988,14 +16747,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_9 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyNumber_Add(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_22 = PyTuple_New(4); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
         __Pyx_INCREF(__pyx_v_chrom);
@@ -17005,17 +16764,17 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         __Pyx_GIVEREF(__pyx_t_7);
         PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_2);
         __Pyx_GIVEREF(__pyx_t_2);
-        PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_t_9);
-        __Pyx_GIVEREF(__pyx_t_9);
+        PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_t_10);
+        __Pyx_GIVEREF(__pyx_t_10);
         __pyx_t_7 = 0;
         __pyx_t_2 = 0;
-        __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
-        __pyx_v_addn = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_addn = __pyx_t_10;
+        __pyx_t_10 = 0;
 
         /* "pysam/cvcf.pyx":767
  *                     # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1
@@ -17024,11 +16783,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     alt = [allele+addn for allele in alt]
  *                 else:
  */
-        __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_ref = __pyx_t_10;
+        __pyx_t_10 = 0;
 
         /* "pysam/cvcf.pyx":768
  *                     addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference)
@@ -17037,8 +16796,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 else:
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
  */
-        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
           __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
           __pyx_t_15 = NULL;
@@ -17050,46 +16809,36 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         for (;;) {
           if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
             if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_10 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_10 = PySequence_ITEM(__pyx_t_22, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
+            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
           } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
             if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_10 = PySequence_ITEM(__pyx_t_22, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
+            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
           } else {
-            __pyx_t_10 = __pyx_t_15(__pyx_t_22);
-            if (unlikely(!__pyx_t_10)) {
+            __pyx_t_8 = __pyx_t_15(__pyx_t_22);
+            if (unlikely(!__pyx_t_8)) {
               if (PyErr_Occurred()) {
                 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               }
               break;
             }
-            __Pyx_GOTREF(__pyx_t_10);
+            __Pyx_GOTREF(__pyx_t_8);
           }
           __Pyx_XDECREF(__pyx_v_allele);
-          __pyx_v_allele = __pyx_t_10;
-          __pyx_t_10 = 0;
-          __pyx_t_10 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_10);
-          if (unlikely(__Pyx_PyList_Append(__pyx_t_9, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_v_allele = __pyx_t_8;
+          __pyx_t_8 = 0;
+          __pyx_t_8 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_8);
+          if (unlikely(PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         }
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = ((PyObject *)__pyx_t_9);
-        __Pyx_INCREF(__pyx_t_22);
-        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+        __Pyx_INCREF(((PyObject *)__pyx_t_10));
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
         __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-        __Pyx_GIVEREF(__pyx_t_22);
-        __pyx_cur_scope->__pyx_v_alt = __pyx_t_22;
-        __pyx_t_22 = 0;
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
+        __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_10);
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
         goto __pyx_L74;
       }
       /*else*/ {
@@ -17101,32 +16850,32 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     ref = addn + ref
  *                     alt = [addn + allele for allele in alt]
  */
-        __pyx_t_22 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_9 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_22 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __Pyx_INCREF(__pyx_v_chrom);
         PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
         __Pyx_GIVEREF(__pyx_v_chrom);
-        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
-        __Pyx_GIVEREF(__pyx_t_9);
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_22);
+        __Pyx_GIVEREF(__pyx_t_22);
         __Pyx_INCREF(__pyx_v_pos);
         PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_pos);
         __Pyx_GIVEREF(__pyx_v_pos);
-        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_10);
-        __Pyx_GIVEREF(__pyx_t_10);
-        __pyx_t_9 = 0;
-        __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_8);
+        __Pyx_GIVEREF(__pyx_t_8);
+        __pyx_t_22 = 0;
+        __pyx_t_8 = 0;
+        __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-        __pyx_v_addn = __pyx_t_10;
-        __pyx_t_10 = 0;
+        __pyx_v_addn = __pyx_t_8;
+        __pyx_t_8 = 0;
 
         /* "pysam/cvcf.pyx":771
  *                 else:
@@ -17135,11 +16884,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     alt = [addn + allele for allele in alt]
  *                     pos -= 1
  */
-        __pyx_t_10 = PyNumber_Add(__pyx_v_addn, __pyx_v_ref); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_8 = PyNumber_Add(__pyx_v_addn, __pyx_v_ref); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_10;
-        __pyx_t_10 = 0;
+        __pyx_v_ref = __pyx_t_8;
+        __pyx_t_8 = 0;
 
         /* "pysam/cvcf.pyx":772
  *                     addn = get_sequence(chrom,pos-1,pos,self._reference)
@@ -17148,8 +16897,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     pos -= 1
  *         else:
  */
-        __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
           __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
           __pyx_t_15 = NULL;
@@ -17161,46 +16910,36 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         for (;;) {
           if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
             if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_22 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_22 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
+            __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
           } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
             if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_22 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_22 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
+            __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++;
           } else {
-            __pyx_t_22 = __pyx_t_15(__pyx_t_2);
-            if (unlikely(!__pyx_t_22)) {
+            __pyx_t_10 = __pyx_t_15(__pyx_t_2);
+            if (unlikely(!__pyx_t_10)) {
               if (PyErr_Occurred()) {
                 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               }
               break;
             }
-            __Pyx_GOTREF(__pyx_t_22);
+            __Pyx_GOTREF(__pyx_t_10);
           }
           __Pyx_XDECREF(__pyx_v_allele);
-          __pyx_v_allele = __pyx_t_22;
-          __pyx_t_22 = 0;
-          __pyx_t_22 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_22);
-          if (unlikely(__Pyx_PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_22))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+          __pyx_v_allele = __pyx_t_10;
+          __pyx_t_10 = 0;
+          __pyx_t_10 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          if (unlikely(PyList_Append(__pyx_t_8, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         }
         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = ((PyObject *)__pyx_t_10);
-        __Pyx_INCREF(__pyx_t_2);
-        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __Pyx_INCREF(((PyObject *)__pyx_t_8));
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
         __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-        __Pyx_GIVEREF(__pyx_t_2);
-        __pyx_cur_scope->__pyx_v_alt = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+        __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_8);
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
         /* "pysam/cvcf.pyx":773
  *                     ref = addn + ref
@@ -17209,11 +16948,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *         else:
  *             # format v4.0 -- just check for nucleotides
  */
-        __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_v_pos);
-        __pyx_v_pos = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_pos = __pyx_t_8;
+        __pyx_t_8 = 0;
       }
       __pyx_L74:;
       goto __pyx_L73;
@@ -17231,42 +16970,34 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     self.error(line,self.V40_BAD_ALLELE,allele)
  */
     if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-      __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+      __pyx_t_8 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
     }
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
       } else {
-        __pyx_t_10 = __pyx_t_15(__pyx_t_2);
-        if (unlikely(!__pyx_t_10)) {
+        __pyx_t_2 = __pyx_t_15(__pyx_t_8);
+        if (unlikely(!__pyx_t_2)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_GOTREF(__pyx_t_2);
       }
       __Pyx_XDECREF(__pyx_v_allele);
-      __pyx_v_allele = __pyx_t_10;
-      __pyx_t_10 = 0;
+      __pyx_v_allele = __pyx_t_2;
+      __pyx_t_2 = 0;
 
       /* "pysam/cvcf.pyx":777
  *             # format v4.0 -- just check for nucleotides
@@ -17275,22 +17006,22 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     self.error(line,self.V40_BAD_ALLELE,allele)
  * 
  */
-      __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_22 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__match); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__match); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
+      __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 = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_allele);
-      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_allele);
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_allele);
       __Pyx_GIVEREF(__pyx_v_allele);
-      __pyx_t_9 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_t_14 = (!__pyx_t_19);
       if (__pyx_t_14) {
 
@@ -17301,31 +17032,31 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *         # check for leading nucleotide in indel calls
  */
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V40_BAD_ALLELE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V40_BAD_ALLELE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_10);
-        __Pyx_GIVEREF(__pyx_t_10);
+        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
+        __Pyx_GIVEREF(__pyx_t_2);
         __Pyx_INCREF(__pyx_v_allele);
-        PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_v_allele);
+        PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_allele);
         __Pyx_GIVEREF(__pyx_v_allele);
-        __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         goto __pyx_L81;
       }
       __pyx_L81:;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   }
   __pyx_L51:;
 
@@ -17337,42 +17068,34 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE)
  */
   if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-    __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+    __pyx_t_8 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
     __pyx_t_15 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
+    __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else {
-      __pyx_t_10 = __pyx_t_15(__pyx_t_2);
-      if (unlikely(!__pyx_t_10)) {
+      __pyx_t_2 = __pyx_t_15(__pyx_t_8);
+      if (unlikely(!__pyx_t_2)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_GOTREF(__pyx_t_2);
     }
     __Pyx_XDECREF(__pyx_v_allele);
-    __pyx_v_allele = __pyx_t_10;
-    __pyx_t_10 = 0;
+    __pyx_v_allele = __pyx_t_2;
+    __pyx_t_2 = 0;
 
     /* "pysam/cvcf.pyx":782
  *         # check for leading nucleotide in indel calls
@@ -17396,23 +17119,23 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
       __pyx_t_3 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_14 = (__pyx_t_3 == 0);
       if (__pyx_t_14) {
-        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ZERO_LENGTH_ALLELE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ZERO_LENGTH_ALLELE); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_22);
-        __Pyx_GIVEREF(__pyx_t_22);
-        __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
+        PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_10);
+        __Pyx_GIVEREF(__pyx_t_10);
+        __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         goto __pyx_L85;
       }
       __pyx_L85:;
@@ -17424,44 +17147,45 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE)
  * 
  */
-      __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_22 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_22);
-      __pyx_t_9 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __pyx_t_22 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_22);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_RichCompare(__pyx_t_22, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_t_22, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_14) {
-        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_22 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_t_22); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_19 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__N), __pyx_t_22, Py_NE)); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_19 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_10, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __pyx_t_5 = __pyx_t_19;
       } else {
         __pyx_t_5 = __pyx_t_14;
@@ -17475,23 +17199,23 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *         # trim trailing bases in alleles
  */
-        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_116); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __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 = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_116); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_INCREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line);
+        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
-        __Pyx_GIVEREF(__pyx_t_9);
-        __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_22);
+        __Pyx_GIVEREF(__pyx_t_22);
+        __pyx_t_22 = 0;
+        __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         goto __pyx_L86;
       }
       __pyx_L86:;
@@ -17499,7 +17223,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
     }
     __pyx_L84:;
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
   /* "pysam/cvcf.pyx":788
  * 
@@ -17518,94 +17242,87 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper():
  *                     break
  */
-    __pyx_t_2 = __Pyx_GetName(__pyx_b, __pyx_n_s__len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
+    __pyx_t_8 = __Pyx_GetName(__pyx_b, __pyx_n_s__len); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_22);
+    PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_8);
+    __Pyx_GIVEREF(__pyx_t_8);
     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alt);
-    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_cur_scope->__pyx_v_alt);
+    PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_cur_scope->__pyx_v_alt);
     __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alt);
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __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 = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
-    __Pyx_GIVEREF(__pyx_t_2);
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
+    __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_22);
+    PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_8);
+    __Pyx_GIVEREF(__pyx_t_8);
+    __pyx_t_8 = 0;
+    __pyx_t_8 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
     __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_10 = PyObject_RichCompare(__pyx_t_8, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_22 = PyObject_RichCompare(__pyx_t_2, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_22); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
     if (__pyx_t_5) {
-      __Pyx_INCREF(__pyx_t_2);
-      __pyx_t_9 = __pyx_t_2;
+      __Pyx_INCREF(__pyx_t_8);
+      __pyx_t_22 = __pyx_t_8;
     } else {
-      __pyx_t_22 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __pyx_t_9 = __pyx_t_22;
-      __pyx_t_22 = 0;
+      __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_22 = __pyx_t_10;
+      __pyx_t_10 = 0;
     }
-    __Pyx_DECREF(__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 = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
     __Pyx_INCREF(__pyx_int_1);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_1);
     __Pyx_GIVEREF(__pyx_int_1);
-    __Pyx_INCREF(__pyx_t_9);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
-    __Pyx_GIVEREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
-      __pyx_t_2 = __pyx_t_9; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+    __Pyx_INCREF(__pyx_t_22);
+    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_22);
+    __Pyx_GIVEREF(__pyx_t_22);
+    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+    __pyx_t_22 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_22);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    if (PyList_CheckExact(__pyx_t_22) || PyTuple_CheckExact(__pyx_t_22)) {
+      __pyx_t_8 = __pyx_t_22; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
       __pyx_t_15 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
+      __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_22); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
     for (;;) {
-      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
-      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+      if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_22 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
+      } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+        __pyx_t_22 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
       } else {
-        __pyx_t_9 = __pyx_t_15(__pyx_t_2);
-        if (unlikely(!__pyx_t_9)) {
+        __pyx_t_22 = __pyx_t_15(__pyx_t_8);
+        if (unlikely(!__pyx_t_22)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_9);
+        __Pyx_GOTREF(__pyx_t_22);
       }
       __Pyx_XDECREF(__pyx_v_i);
-      __pyx_v_i = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __pyx_v_i = __pyx_t_22;
+      __pyx_t_22 = 0;
 
       /* "pysam/cvcf.pyx":790
  *         if alt:
@@ -17614,44 +17331,45 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     break
  *                 ref, alt = ref[:-1], [allele[:-1] for allele in alt]
  */
-      __pyx_t_9 = __pyx_pf_5pysam_4cvcf_3VCF_10parse_data_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_22 = __pyx_pf_5pysam_4cvcf_3VCF_10parse_data_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_22);
-      PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_9);
-      __Pyx_GIVEREF(__pyx_t_9);
-      __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
-      __pyx_t_3 = PySet_Size(__pyx_t_9); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_22);
+      __Pyx_GIVEREF(__pyx_t_22);
+      __pyx_t_22 = 0;
+      __pyx_t_22 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __pyx_t_3 = PySet_Size(__pyx_t_22); 
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
       __pyx_t_5 = (__pyx_t_3 > 1);
       if (!__pyx_t_5) {
-        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_ref, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_22 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_alt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_ref, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_22, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_22);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_alt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_22); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_10, ((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);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_RichCompare(__pyx_t_22, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
         __pyx_t_19 = __pyx_t_14;
       } else {
         __pyx_t_19 = __pyx_t_5;
@@ -17677,35 +17395,27 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *         # left-align alleles, if a reference is available
  */
-      __pyx_t_22 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_2 = PyList_New(0); 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);
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-        __pyx_t_9 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_9); __pyx_t_3 = 0;
+        __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_3 = 0;
         __pyx_t_26 = NULL;
       } else {
-        __pyx_t_3 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_26 = Py_TYPE(__pyx_t_9)->tp_iternext;
+        __pyx_t_3 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_26 = Py_TYPE(__pyx_t_22)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_26 && PyList_CheckExact(__pyx_t_9)) {
-          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_9)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_7 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_26 && PyTuple_CheckExact(__pyx_t_9)) {
-          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_7 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+        if (!__pyx_t_26 && PyList_CheckExact(__pyx_t_22)) {
+          if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_22)) break;
+          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
+        } else if (!__pyx_t_26 && PyTuple_CheckExact(__pyx_t_22)) {
+          if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
+          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
         } else {
-          __pyx_t_7 = __pyx_t_26(__pyx_t_9);
+          __pyx_t_7 = __pyx_t_26(__pyx_t_22);
           if (unlikely(!__pyx_t_7)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -17720,24 +17430,24 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         __pyx_t_7 = 0;
         __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        if (unlikely(__Pyx_PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       }
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = ((PyObject *)__pyx_t_10);
-      __Pyx_INCREF(__pyx_t_9);
-      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      __pyx_t_22 = ((PyObject *)__pyx_t_2);
+      __Pyx_INCREF(__pyx_t_22);
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_DECREF(__pyx_v_ref);
-      __pyx_v_ref = __pyx_t_22;
-      __pyx_t_22 = 0;
+      __pyx_v_ref = __pyx_t_10;
+      __pyx_t_10 = 0;
       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
       __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-      __Pyx_GIVEREF(__pyx_t_9);
-      __pyx_cur_scope->__pyx_v_alt = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __Pyx_GIVEREF(__pyx_t_22);
+      __pyx_cur_scope->__pyx_v_alt = __pyx_t_22;
+      __pyx_t_22 = 0;
     }
     __pyx_L89_break:;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L87;
   }
   __pyx_L87:;
@@ -17749,15 +17459,15 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             while left < pos:
  *                 movable = True
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___leftalign); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___leftalign); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   if (__pyx_t_19) {
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     __pyx_t_14 = __pyx_t_5;
   } else {
     __pyx_t_14 = __pyx_t_19;
@@ -17773,9 +17483,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
     while (1) {
       if (unlikely(!__pyx_v_left)) { __Pyx_RaiseUnboundLocalError("left"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-      __pyx_t_2 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_8 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       if (!__pyx_t_14) break;
 
       /* "pysam/cvcf.pyx":797
@@ -17795,42 +17506,34 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                         longest, shortest = allele, ref
  */
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-        __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+        __pyx_t_8 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
         __pyx_t_15 = NULL;
       } else {
-        __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); 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);
-        __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
+        __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
-          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
-          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_9 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
+          __pyx_t_22 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
+        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+          __pyx_t_22 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
         } else {
-          __pyx_t_9 = __pyx_t_15(__pyx_t_2);
-          if (unlikely(!__pyx_t_9)) {
+          __pyx_t_22 = __pyx_t_15(__pyx_t_8);
+          if (unlikely(!__pyx_t_22)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
               else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             }
             break;
           }
-          __Pyx_GOTREF(__pyx_t_9);
+          __Pyx_GOTREF(__pyx_t_22);
         }
         __Pyx_XDECREF(__pyx_v_allele);
-        __pyx_v_allele = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_allele = __pyx_t_22;
+        __pyx_t_22 = 0;
 
         /* "pysam/cvcf.pyx":799
  *                 movable = True
@@ -17851,16 +17554,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     else:
  *                         longest, shortest = ref, allele
  */
-          __pyx_t_9 = __pyx_v_allele;
-          __Pyx_INCREF(__pyx_t_9);
-          __pyx_t_22 = __pyx_v_ref;
+          __pyx_t_22 = __pyx_v_allele;
           __Pyx_INCREF(__pyx_t_22);
+          __pyx_t_10 = __pyx_v_ref;
+          __Pyx_INCREF(__pyx_t_10);
           __Pyx_XDECREF(__pyx_v_longest);
-          __pyx_v_longest = __pyx_t_9;
-          __pyx_t_9 = 0;
-          __Pyx_XDECREF(__pyx_v_shortest);
-          __pyx_v_shortest = __pyx_t_22;
+          __pyx_v_longest = __pyx_t_22;
           __pyx_t_22 = 0;
+          __Pyx_XDECREF(__pyx_v_shortest);
+          __pyx_v_shortest = __pyx_t_10;
+          __pyx_t_10 = 0;
           goto __pyx_L98;
         }
         /*else*/ {
@@ -17872,16 +17575,16 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper():
  *                         movable = False
  */
-          __pyx_t_22 = __pyx_v_ref;
+          __pyx_t_10 = __pyx_v_ref;
+          __Pyx_INCREF(__pyx_t_10);
+          __pyx_t_22 = __pyx_v_allele;
           __Pyx_INCREF(__pyx_t_22);
-          __pyx_t_9 = __pyx_v_allele;
-          __Pyx_INCREF(__pyx_t_9);
           __Pyx_XDECREF(__pyx_v_longest);
-          __pyx_v_longest = __pyx_t_22;
-          __pyx_t_22 = 0;
+          __pyx_v_longest = __pyx_t_10;
+          __pyx_t_10 = 0;
           __Pyx_XDECREF(__pyx_v_shortest);
-          __pyx_v_shortest = __pyx_t_9;
-          __pyx_t_9 = 0;
+          __pyx_v_shortest = __pyx_t_22;
+          __pyx_t_22 = 0;
         }
         __pyx_L98:;
 
@@ -17897,24 +17600,25 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         __pyx_t_14 = (__pyx_t_21 == __pyx_t_3);
         if (!__pyx_t_14) {
           __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
-          __pyx_t_22 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_22 = __Pyx_PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_22);
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-          __pyx_t_9 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_9);
+          __pyx_t_10 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
           __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          __pyx_t_22 = PyObject_GetAttr(__pyx_v_shortest, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_22);
-          __pyx_t_10 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_10 = PyObject_GetAttr(__pyx_v_shortest, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_10);
-          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          __pyx_t_22 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_22); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+          __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-          __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_10 = PyObject_RichCompare(__pyx_t_22, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
           __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
           __pyx_t_5 = __pyx_t_19;
         } else {
           __pyx_t_5 = __pyx_t_14;
@@ -17940,29 +17644,30 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                         movable = False
  *                 if not movable:
  */
-        __pyx_t_22 = __Pyx_GetItemInt(__pyx_v_longest, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_10 = PyObject_GetAttr(__pyx_t_22, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_longest, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_21 = (__pyx_t_3 - 1);
-        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_longest, __pyx_t_21, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyObject_RichCompare(__pyx_t_22, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_longest, __pyx_t_21, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_22 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_2 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_22 = PyObject_RichCompare(__pyx_t_10, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         if (__pyx_t_5) {
 
           /* "pysam/cvcf.pyx":806
@@ -17977,7 +17682,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
         }
         __pyx_L100:;
       }
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
       /* "pysam/cvcf.pyx":807
  *                     if longest[-1].upper() != longest[len(shortest)-1].upper():
@@ -18008,11 +17713,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 alt = [allele[:-1] for allele in alt]
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  */
-      __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __Pyx_DECREF(__pyx_v_ref);
-      __pyx_v_ref = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_ref = __pyx_t_8;
+      __pyx_t_8 = 0;
 
       /* "pysam/cvcf.pyx":810
  *                     break
@@ -18021,59 +17726,49 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
  *                     ref = faref_leftflank[pos-left-1] + ref
  */
-      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-        __pyx_t_9 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_9); __pyx_t_4 = 0;
+        __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
         __pyx_t_15 = NULL;
       } else {
-        __pyx_t_4 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __pyx_t_15 = Py_TYPE(__pyx_t_9)->tp_iternext;
+        __pyx_t_4 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_15 = Py_TYPE(__pyx_t_22)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_9)) {
-          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_10 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_10 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_9)) {
-          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_10 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
+          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
+          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
         } else {
-          __pyx_t_10 = __pyx_t_15(__pyx_t_9);
-          if (unlikely(!__pyx_t_10)) {
+          __pyx_t_2 = __pyx_t_15(__pyx_t_22);
+          if (unlikely(!__pyx_t_2)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
               else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             }
             break;
           }
-          __Pyx_GOTREF(__pyx_t_10);
+          __Pyx_GOTREF(__pyx_t_2);
         }
         __Pyx_XDECREF(__pyx_v_allele);
-        __pyx_v_allele = __pyx_t_10;
-        __pyx_t_10 = 0;
-        __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_v_allele = __pyx_t_2;
+        __pyx_t_2 = 0;
+        __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        if (unlikely(PyList_Append(__pyx_t_8, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_9 = ((PyObject *)__pyx_t_2);
-      __Pyx_INCREF(__pyx_t_9);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      __Pyx_INCREF(((PyObject *)__pyx_t_8));
       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
       __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-      __Pyx_GIVEREF(__pyx_t_9);
-      __pyx_cur_scope->__pyx_v_alt = __pyx_t_9;
-      __pyx_t_9 = 0;
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
       /* "pysam/cvcf.pyx":811
  *                 ref = ref[:-1]
@@ -18082,65 +17777,58 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     ref = faref_leftflank[pos-left-1] + ref
  *                     alt = [faref_leftflank[pos-left-1] + allele for allele in alt]
  */
-      __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-        __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+        __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
         __pyx_t_15 = NULL;
       } else {
-        __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
+        __pyx_t_4 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_15 = Py_TYPE(__pyx_t_22)->tp_iternext;
       }
       for (;;) {
-        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
-          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
-        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
-          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-          #if CYTHON_COMPILING_IN_CPYTHON
-          __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #else
-          __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          #endif
+        if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
+          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
+          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+        } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
+          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
+          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
         } else {
-          __pyx_t_10 = __pyx_t_15(__pyx_t_2);
-          if (unlikely(!__pyx_t_10)) {
+          __pyx_t_2 = __pyx_t_15(__pyx_t_22);
+          if (unlikely(!__pyx_t_2)) {
             if (PyErr_Occurred()) {
               if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
               else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             }
             break;
           }
-          __Pyx_GOTREF(__pyx_t_10);
+          __Pyx_GOTREF(__pyx_t_2);
         }
         __Pyx_XDECREF(__pyx_v_allele);
-        __pyx_v_allele = __pyx_t_10;
-        __pyx_t_10 = 0;
+        __pyx_v_allele = __pyx_t_2;
+        __pyx_t_2 = 0;
         __pyx_t_21 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
-        if (unlikely(__Pyx_PyList_Append(__pyx_t_9, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        if (unlikely(PyList_Append(__pyx_t_8, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       }
-      __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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(((PyObject *)__pyx_t_9));
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_9));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
-      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-      __pyx_t_9 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __Pyx_INCREF(((PyObject *)__pyx_t_8));
+      PyTuple_SET_ITEM(__pyx_t_22, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
+      __pyx_t_22 = PyObject_RichCompare(__pyx_t_8, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_22);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
       if (!__pyx_t_5) {
         __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_14 = (__pyx_t_4 == 0);
@@ -18158,20 +17846,20 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     pos -= 1
  */
         if (unlikely(!__pyx_v_faref_leftflank)) { __Pyx_RaiseUnboundLocalError("faref_leftflank"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-        __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_9 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_9); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_v_ref); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_22 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __pyx_t_8 = PyNumber_Subtract(__pyx_t_22, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __pyx_t_22 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_8); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_22);
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_8 = PyNumber_Add(__pyx_t_22, __pyx_v_ref); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         __Pyx_DECREF(__pyx_v_ref);
-        __pyx_v_ref = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_v_ref = __pyx_t_8;
+        __pyx_t_8 = 0;
 
         /* "pysam/cvcf.pyx":813
  *                 if min([len(allele) for allele in alt]) == 0 or len(ref) == 0:
@@ -18180,68 +17868,58 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     pos -= 1
  * 
  */
-        __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_9);
+        __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
-          __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+          __pyx_t_22 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
           __pyx_t_15 = NULL;
         } else {
-          __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext;
+          __pyx_t_4 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_22);
+          __pyx_t_15 = Py_TYPE(__pyx_t_22)->tp_iternext;
         }
         for (;;) {
-          if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) {
-            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
-          } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) {
-            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
+          if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
+            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
+            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+          } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
+            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
+            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
           } else {
-            __pyx_t_10 = __pyx_t_15(__pyx_t_2);
-            if (unlikely(!__pyx_t_10)) {
+            __pyx_t_2 = __pyx_t_15(__pyx_t_22);
+            if (unlikely(!__pyx_t_2)) {
               if (PyErr_Occurred()) {
                 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
               }
               break;
             }
-            __Pyx_GOTREF(__pyx_t_10);
+            __Pyx_GOTREF(__pyx_t_2);
           }
           __Pyx_XDECREF(__pyx_v_allele);
-          __pyx_v_allele = __pyx_t_10;
-          __pyx_t_10 = 0;
-          __pyx_t_10 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_v_allele = __pyx_t_2;
+          __pyx_t_2 = 0;
+          __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_10 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_10);
-          __pyx_t_22 = PyNumber_Subtract(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_22);
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __pyx_t_2 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_10); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-          __pyx_t_10 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_22); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_v_allele); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_10);
-          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          __pyx_t_22 = PyNumber_Add(__pyx_t_10, __pyx_v_allele); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_22);
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          if (unlikely(PyList_Append(__pyx_t_8, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-          if (unlikely(__Pyx_PyList_Append(__pyx_t_9, (PyObject*)__pyx_t_22))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
         }
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = ((PyObject *)__pyx_t_9);
-        __Pyx_INCREF(__pyx_t_2);
-        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+        __Pyx_INCREF(((PyObject *)__pyx_t_8));
         __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
         __Pyx_DECREF(__pyx_cur_scope->__pyx_v_alt);
-        __Pyx_GIVEREF(__pyx_t_2);
-        __pyx_cur_scope->__pyx_v_alt = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+        __pyx_cur_scope->__pyx_v_alt = ((PyObject *)__pyx_t_8);
+        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
         /* "pysam/cvcf.pyx":814
  *                     ref = faref_leftflank[pos-left-1] + ref
@@ -18250,11 +17928,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *         # parse sample columns
  */
-        __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __Pyx_DECREF(__pyx_v_pos);
-        __pyx_v_pos = __pyx_t_2;
-        __pyx_t_2 = 0;
+        __pyx_v_pos = __pyx_t_8;
+        __pyx_t_8 = 0;
         goto __pyx_L104;
       }
       __pyx_L104:;
@@ -18271,10 +17949,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *         for sample in cols[9:]:
  *             dict = {}
  */
-  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_v_samples = __pyx_t_2;
-  __pyx_t_2 = 0;
+  __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_v_samples = __pyx_t_8;
+  __pyx_t_8 = 0;
 
   /* "pysam/cvcf.pyx":818
  *         # parse sample columns
@@ -18283,46 +17961,38 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             dict = {}
  *             values = sample.split(':')
  */
-  __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_cols, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-    __pyx_t_9 = __pyx_t_2; __Pyx_INCREF(__pyx_t_9); __pyx_t_4 = 0;
+  __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_cols, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
+    __pyx_t_22 = __pyx_t_8; __Pyx_INCREF(__pyx_t_22); __pyx_t_4 = 0;
     __pyx_t_15 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_15 = Py_TYPE(__pyx_t_9)->tp_iternext;
+    __pyx_t_4 = -1; __pyx_t_22 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_22);
+    __pyx_t_15 = Py_TYPE(__pyx_t_22)->tp_iternext;
   }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   for (;;) {
-    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_9)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_9)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_9)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+    if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_22)) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_22)) break;
+      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
+    } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_22)) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_22)) break;
+      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_22, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
     } else {
-      __pyx_t_2 = __pyx_t_15(__pyx_t_9);
-      if (unlikely(!__pyx_t_2)) {
+      __pyx_t_8 = __pyx_t_15(__pyx_t_22);
+      if (unlikely(!__pyx_t_8)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(__pyx_t_8);
     }
     __Pyx_XDECREF(__pyx_v_sample);
-    __pyx_v_sample = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_sample = __pyx_t_8;
+    __pyx_t_8 = 0;
 
     /* "pysam/cvcf.pyx":819
  *         samples = []
@@ -18331,11 +18001,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             values = sample.split(':')
  *             if len(values) > len(format):
  */
-    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
     __Pyx_XDECREF(((PyObject *)__pyx_v_dict));
-    __pyx_v_dict = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_v_dict = __pyx_t_8;
+    __pyx_t_8 = 0;
 
     /* "pysam/cvcf.pyx":820
  *         for sample in cols[9:]:
@@ -18344,14 +18014,14 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             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)))
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_sample, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_22 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_22);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_8 = PyObject_GetAttr(__pyx_v_sample, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     __Pyx_XDECREF(__pyx_v_values);
-    __pyx_v_values = __pyx_t_22;
-    __pyx_t_22 = 0;
+    __pyx_v_values = __pyx_t_10;
+    __pyx_t_10 = 0;
 
     /* "pysam/cvcf.pyx":821
  *             dict = {}
@@ -18372,26 +18042,26 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             for idx in range(len(format)):
  *                 expected = self.get_expected(format[idx], self._format, alt)
  */
-      __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_18); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_18); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __pyx_t_3 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_24);
-      PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_10);
-      __Pyx_GIVEREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_sample);
       PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_v_sample);
       __Pyx_GIVEREF(__pyx_v_sample);
       PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
-      __pyx_t_10 = 0;
+      __pyx_t_2 = 0;
       __pyx_t_7 = 0;
       __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_24)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_7));
@@ -18401,15 +18071,15 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
       __Pyx_INCREF(__pyx_v_line);
       PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       PyTuple_SET_ITEM(__pyx_t_24, 2, ((PyObject *)__pyx_t_7));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
-      __pyx_t_2 = 0;
+      __pyx_t_8 = 0;
       __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_24)); __pyx_t_24 = 0;
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L111;
@@ -18446,18 +18116,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
     for (;;) {
       if (!__pyx_t_26 && PyList_CheckExact(__pyx_t_24)) {
         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_24)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_7 = PySequence_ITEM(__pyx_t_24, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
       } else if (!__pyx_t_26 && PyTuple_CheckExact(__pyx_t_24)) {
         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_24)) break;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #else
-        __pyx_t_7 = PySequence_ITEM(__pyx_t_24, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        #endif
+        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
       } else {
         __pyx_t_7 = __pyx_t_26(__pyx_t_24);
         if (unlikely(!__pyx_t_7)) {
@@ -18482,28 +18144,28 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
       __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_expected); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_22 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_22);
-      __Pyx_GIVEREF(__pyx_t_22);
-      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
-      __Pyx_GIVEREF(__pyx_t_2);
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
+      __Pyx_GIVEREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alt);
-      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_cur_scope->__pyx_v_alt);
+      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_cur_scope->__pyx_v_alt);
       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alt);
-      __pyx_t_22 = 0;
-      __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_10 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
       __Pyx_XDECREF(__pyx_v_expected);
-      __pyx_v_expected = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_v_expected = __pyx_t_8;
+      __pyx_t_8 = 0;
 
       /* "pysam/cvcf.pyx":825
  *             for idx in range(len(format)):
@@ -18513,18 +18175,19 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     if expected == -1: value = "."
  */
       __pyx_t_21 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_8, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_10 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       if (__pyx_t_19) {
-        __pyx_t_10 = PyObject_GetItem(__pyx_v_values, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_2 = PyObject_GetItem(__pyx_v_values, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_XDECREF(__pyx_v_value);
-        __pyx_v_value = __pyx_t_10;
-        __pyx_t_10 = 0;
+        __pyx_v_value = __pyx_t_2;
+        __pyx_t_2 = 0;
         goto __pyx_L114;
       }
       /*else*/ {
@@ -18536,9 +18199,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     else: value = ",".join(["."]*expected)
  * 
  */
-        __pyx_t_10 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         if (__pyx_t_19) {
           __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
           __Pyx_XDECREF(__pyx_v_value);
@@ -18554,30 +18218,30 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  * 
  *                 dict[format[idx]] = self.parse_formatdata(format[idx],
  */
-          __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_10);
-          __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_8);
           __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
-          PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9));
+          PyList_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_9));
           __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
-          { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_expected); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_expected); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_temp);
-            __Pyx_DECREF(__pyx_t_2);
-            __pyx_t_2 = __pyx_temp;
+            __Pyx_DECREF(__pyx_t_8);
+            __pyx_t_8 = __pyx_temp;
           }
-          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_7);
-          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2));
-          __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-          __pyx_t_2 = 0;
-          __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_7);
+          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
+          __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+          __pyx_t_8 = 0;
+          __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __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_7)); __pyx_t_7 = 0;
           __Pyx_XDECREF(__pyx_v_value);
-          __pyx_v_value = __pyx_t_2;
-          __pyx_t_2 = 0;
+          __pyx_v_value = __pyx_t_8;
+          __pyx_t_8 = 0;
         }
         __pyx_L115:;
       }
@@ -18590,8 +18254,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                                                           value,
  *                                                           self._format,
  */
-      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
       __pyx_t_7 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_7);
 
@@ -18602,8 +18266,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                                                           line)
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
  */
-      __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
 
       /* "pysam/cvcf.pyx":833
  *                                                           value,
@@ -18612,24 +18276,24 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
  */
-      __pyx_t_22 = PyTuple_New(4); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_7);
+      __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
       __Pyx_GIVEREF(__pyx_t_7);
       __Pyx_INCREF(__pyx_v_value);
-      PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_v_value);
+      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_value);
       __Pyx_GIVEREF(__pyx_v_value);
-      PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_10);
-      __Pyx_GIVEREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_2);
+      __Pyx_GIVEREF(__pyx_t_2);
       __Pyx_INCREF(__pyx_v_line);
-      PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_v_line);
+      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_v_line);
       __Pyx_GIVEREF(__pyx_v_line);
       __pyx_t_7 = 0;
-      __pyx_t_10 = 0;
-      __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_22), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
+      __pyx_t_2 = 0;
+      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
 
       /* "pysam/cvcf.pyx":830
  *                     else: value = ",".join(["."]*expected)
@@ -18638,11 +18302,11 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                                                           value,
  *                                                           self._format,
  */
-      __pyx_t_22 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_22);
-      if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_22, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_10, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
       /* "pysam/cvcf.pyx":834
  *                                                           self._format,
@@ -18651,23 +18315,25 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
  *                                "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]]))
  */
-      __pyx_t_10 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       if (__pyx_t_19) {
-        __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_2); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_22 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        __pyx_t_21 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-        __pyx_t_21 = PyObject_Length(__pyx_t_22); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __pyx_t_10 = PyObject_RichCompare(__pyx_t_22, __pyx_v_expected, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __pyx_t_14 = __pyx_t_5;
       } else {
         __pyx_t_14 = __pyx_t_19;
@@ -18681,10 +18347,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                                "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]]))
  */
-        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
 
         /* "pysam/cvcf.pyx":836
  *                 if expected != -1 and len(dict[format[idx]]) != expected:
@@ -18693,43 +18359,43 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     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]
  */
-        __pyx_t_2 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
+        __pyx_t_8 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_7 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_7); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
+        __pyx_t_23 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_7); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_23);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
+        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
+        __Pyx_GIVEREF(__pyx_t_8);
         __Pyx_INCREF(__pyx_v_expected);
         PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_expected);
         __Pyx_GIVEREF(__pyx_v_expected);
-        PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_8);
-        __Pyx_GIVEREF(__pyx_t_8);
-        __pyx_t_2 = 0;
+        PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_23);
+        __Pyx_GIVEREF(__pyx_t_23);
         __pyx_t_8 = 0;
-        __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+        __pyx_t_23 = 0;
+        __pyx_t_23 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_23));
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
         __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_INCREF(__pyx_v_line);
         PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line);
         __Pyx_GIVEREF(__pyx_v_line);
-        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_22);
-        __Pyx_GIVEREF(__pyx_t_22);
-        PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_t_8));
-        __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
-        __pyx_t_22 = 0;
-        __pyx_t_8 = 0;
-        __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_10);
+        __Pyx_GIVEREF(__pyx_t_10);
+        PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_t_23));
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_23));
+        __pyx_t_10 = 0;
+        __pyx_t_23 = 0;
+        __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_23);
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
         __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
 
         /* "pysam/cvcf.pyx":837
  *                     self.error(line,self.BAD_NUMBER_OF_PARAMETERS,
@@ -18738,62 +18404,63 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *                     dict[format[idx]] = dict[format[idx]][:expected]
  *             samples.append( dict )
  */
-        __pyx_t_8 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_8); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_23 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_23);
+        __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_23); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
         __pyx_t_21 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_v_expected, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_23 = PyObject_RichCompare(__pyx_t_7, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_23);
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_23); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
         if (__pyx_t_14) {
-          __pyx_t_8 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_8); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_23 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_23);
+          __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_23); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_7);
+          __pyx_t_2 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_2); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
+          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+          __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
           __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_10);
-          __pyx_t_22 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_22);
+          __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_8);
           __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-          __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_22, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_21 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_8);
+          __pyx_t_10 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           __Pyx_GOTREF(__pyx_t_10);
-          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          __pyx_t_22 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_22);
-          __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_22); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          __pyx_t_21 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-          __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          __pyx_t_22 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_22);
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-          __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_2);
-          PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
-          __Pyx_GIVEREF(__pyx_t_10);
-          { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_t_22); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_8);
+          PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
+          __Pyx_GIVEREF(__pyx_t_2);
+          { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
             __Pyx_GOTREF(__pyx_temp);
-            __Pyx_DECREF(__pyx_t_2);
-            __pyx_t_2 = __pyx_temp;
+            __Pyx_DECREF(__pyx_t_8);
+            __pyx_t_8 = __pyx_temp;
           }
-          __pyx_t_10 = 0;
-          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          __pyx_t_22 = PyNumber_InPlaceAdd(__pyx_t_7, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_22);
+          __pyx_t_2 = 0;
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_t_7, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_10);
           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-          if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_8, __pyx_t_22) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+          if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_23, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
           goto __pyx_L117;
         }
         __pyx_L117:;
@@ -18805,20 +18472,20 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             samples.append( dict )
  * 
  */
-        __pyx_t_8 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __pyx_t_22 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_8); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_23 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_23);
+        __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_23); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
         __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_expected); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_t_22, 0, __pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __pyx_t_22 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_22) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_22);
-        if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_22, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_23 = __Pyx_PySequence_GetSlice(__pyx_t_10, 0, __pyx_t_21); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_23);
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_10 = PyObject_GetItem(__pyx_v_format, __pyx_v_idx); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_10);
+        if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_10, __pyx_t_23) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
         goto __pyx_L116;
       }
       __pyx_L116:;
@@ -18834,7 +18501,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
     __pyx_t_25 = PyList_Append(__pyx_v_samples, ((PyObject *)__pyx_v_dict)); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
 
   /* "pysam/cvcf.pyx":842
  * 
@@ -18843,9 +18510,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *              'pos':pos,      # return 0-based position
  *              'id':id,
  */
-  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__chrom), __pyx_v_chrom) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_22 = PyDict_New(); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_22));
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__chrom), __pyx_v_chrom) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "pysam/cvcf.pyx":843
  *         # done
@@ -18854,7 +18521,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *              'id':id,
  *              'ref':ref,
  */
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__pos), __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__pos), __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "pysam/cvcf.pyx":844
  *         d = {'chrom':chrom,
@@ -18863,7 +18530,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *              'ref':ref,
  *              'alt':alt,
  */
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "pysam/cvcf.pyx":845
  *              'pos':pos,      # return 0-based position
@@ -18872,7 +18539,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *              'alt':alt,
  *              'qual':qual,
  */
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__ref), __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__ref), __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "pysam/cvcf.pyx":846
  *              'id':id,
@@ -18881,7 +18548,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *              'qual':qual,
  *              'filter':filter,
  */
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__alt), __pyx_cur_scope->__pyx_v_alt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__alt), __pyx_cur_scope->__pyx_v_alt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "pysam/cvcf.pyx":847
  *              'ref':ref,
@@ -18892,7 +18559,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  */
   __pyx_t_24 = PyFloat_FromDouble(__pyx_v_qual); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_24);
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__qual), __pyx_t_24) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__qual), __pyx_t_24) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
 
   /* "pysam/cvcf.pyx":848
@@ -18902,7 +18569,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *              'info':info,
  *              'format':format}
  */
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__filter), __pyx_v_filter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__filter), __pyx_v_filter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "pysam/cvcf.pyx":849
  *              'qual':qual,
@@ -18911,7 +18578,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *              'format':format}
  *         for key,value in zip(self._samples,samples):
  */
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_v_info)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_v_info)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "pysam/cvcf.pyx":850
  *              'filter':filter,
@@ -18920,9 +18587,9 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *         for key,value in zip(self._samples,samples):
  *             d[key] = value
  */
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__format), __pyx_v_format) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_d = __pyx_t_9;
-  __pyx_t_9 = 0;
+  if (PyDict_SetItem(__pyx_t_22, ((PyObject *)__pyx_n_s__format), __pyx_v_format) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_d = __pyx_t_22;
+  __pyx_t_22 = 0;
 
   /* "pysam/cvcf.pyx":851
  *              'info':info,
@@ -18931,109 +18598,94 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_32parse_data(CYTHON_UNUSED PyObject
  *             d[key] = value
  * 
  */
-  __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_22 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_22);
   __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_24);
-  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_22);
+  __Pyx_GIVEREF(__pyx_t_22);
   __Pyx_INCREF(((PyObject *)__pyx_v_samples));
   PyTuple_SET_ITEM(__pyx_t_24, 1, ((PyObject *)__pyx_v_samples));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_samples));
-  __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_22 = 0;
+  __pyx_t_22 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_24), NULL); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_22);
   __Pyx_DECREF(((PyObject *)__pyx_t_24)); __pyx_t_24 = 0;
-  if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
-    __pyx_t_24 = __pyx_t_9; __Pyx_INCREF(__pyx_t_24); __pyx_t_4 = 0;
+  if (PyList_CheckExact(__pyx_t_22) || PyTuple_CheckExact(__pyx_t_22)) {
+    __pyx_t_24 = __pyx_t_22; __Pyx_INCREF(__pyx_t_24); __pyx_t_4 = 0;
     __pyx_t_15 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_24 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = -1; __pyx_t_24 = PyObject_GetIter(__pyx_t_22); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_24);
     __pyx_t_15 = Py_TYPE(__pyx_t_24)->tp_iternext;
   }
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
   for (;;) {
     if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_24)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_24)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_9 = PySequence_ITEM(__pyx_t_24, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_22 = PyList_GET_ITEM(__pyx_t_24, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
     } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_24)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_24)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_9 = PySequence_ITEM(__pyx_t_24, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_22 = PyTuple_GET_ITEM(__pyx_t_24, __pyx_t_4); __Pyx_INCREF(__pyx_t_22); __pyx_t_4++;
     } else {
-      __pyx_t_9 = __pyx_t_15(__pyx_t_24);
-      if (unlikely(!__pyx_t_9)) {
+      __pyx_t_22 = __pyx_t_15(__pyx_t_24);
+      if (unlikely(!__pyx_t_22)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_9);
+      __Pyx_GOTREF(__pyx_t_22);
     }
-    if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
-      PyObject* sequence = __pyx_t_9;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      Py_ssize_t size = Py_SIZE(sequence);
-      #else
-      Py_ssize_t size = PySequence_Size(sequence);
-      #endif
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      }
-      #if CYTHON_COMPILING_IN_CPYTHON
+    if ((likely(PyTuple_CheckExact(__pyx_t_22))) || (PyList_CheckExact(__pyx_t_22))) {
+      PyObject* sequence = __pyx_t_22;
       if (likely(PyTuple_CheckExact(sequence))) {
-        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
-        __pyx_t_22 = PyTuple_GET_ITEM(sequence, 1); 
+        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_t_23 = PyTuple_GET_ITEM(sequence, 0); 
+        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
       } else {
-        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
-        __pyx_t_22 = PyList_GET_ITEM(sequence, 1); 
+        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_t_23 = PyList_GET_ITEM(sequence, 0); 
+        __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
       }
-      __Pyx_INCREF(__pyx_t_8);
-      __Pyx_INCREF(__pyx_t_22);
-      #else
-      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_22 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    } else
-    {
+      __Pyx_INCREF(__pyx_t_23);
+      __Pyx_INCREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+    } else {
       Py_ssize_t index = -1;
-      __pyx_t_2 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_t_27 = Py_TYPE(__pyx_t_2)->tp_iternext;
-      index = 0; __pyx_t_8 = __pyx_t_27(__pyx_t_2); if (unlikely(!__pyx_t_8)) goto __pyx_L120_unpacking_failed;
+      __pyx_t_8 = PyObject_GetIter(__pyx_t_22); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_8);
-      index = 1; __pyx_t_22 = __pyx_t_27(__pyx_t_2); if (unlikely(!__pyx_t_22)) goto __pyx_L120_unpacking_failed;
-      __Pyx_GOTREF(__pyx_t_22);
-      if (__Pyx_IternextUnpackEndCheck(__pyx_t_27(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_27 = NULL;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
+      __pyx_t_27 = Py_TYPE(__pyx_t_8)->tp_iternext;
+      index = 0; __pyx_t_23 = __pyx_t_27(__pyx_t_8); if (unlikely(!__pyx_t_23)) goto __pyx_L120_unpacking_failed;
+      __Pyx_GOTREF(__pyx_t_23);
+      index = 1; __pyx_t_10 = __pyx_t_27(__pyx_t_8); if (unlikely(!__pyx_t_10)) goto __pyx_L120_unpacking_failed;
+      __Pyx_GOTREF(__pyx_t_10);
+      if (__Pyx_IternextUnpackEndCheck(__pyx_t_27(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       goto __pyx_L121_unpacking_done;
       __pyx_L120_unpacking_failed:;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_27 = NULL;
-      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      __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 = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __pyx_L121_unpacking_done:;
     }
     __Pyx_XDECREF(__pyx_v_key);
-    __pyx_v_key = __pyx_t_8;
-    __pyx_t_8 = 0;
+    __pyx_v_key = __pyx_t_23;
+    __pyx_t_23 = 0;
     __Pyx_XDECREF(__pyx_v_value);
-    __pyx_v_value = __pyx_t_22;
-    __pyx_t_22 = 0;
+    __pyx_v_value = __pyx_t_10;
+    __pyx_t_10 = 0;
 
     /* "pysam/cvcf.pyx":852
  *              'format':format}
@@ -19123,11 +18775,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_35write_data(PyObject *__pyx_self, P
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_v_data = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__data,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write_data (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__data,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -19142,15 +18795,18 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_35write_data(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write_data", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write_data", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -19281,18 +18937,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else {
       __pyx_t_2 = __pyx_t_5(__pyx_t_3);
       if (unlikely(!__pyx_t_2)) {
@@ -19315,7 +18963,7 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject
  *         if data['alt'] == []: alt = "."
  *         else: alt = ",".join(data['alt'])
  */
-    __pyx_t_6 = (__Pyx_PySequence_Contains(__pyx_v_k, __pyx_v_data, Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_data, __pyx_v_k))); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     if (__pyx_t_6) {
       __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
@@ -19356,7 +19004,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -19402,7 +19051,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject
  */
   __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__filter)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -19423,7 +19073,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __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_2)); __pyx_t_2 = 0;
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -19439,7 +19090,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject
  */
     __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -19499,7 +19151,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject
  */
   __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__qual)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -19698,18 +19351,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_34write_data(CYTHON_UNUSED PyObject
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_11)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_11)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_11)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++;
     } else {
       __pyx_t_8 = __pyx_t_5(__pyx_t_11);
       if (unlikely(!__pyx_t_8)) {
@@ -19829,11 +19474,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_37_parse_header = {__Pyx_NAMESTR
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_parse_header (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -19847,10 +19493,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_37_parse_header(PyObject *__pyx_self
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_parse_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -19931,18 +19579,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_36_parse_header(CYTHON_UNUSED PyObje
   for (;;) {
     if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
     } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++;
     } else {
       __pyx_t_4 = __pyx_t_3(__pyx_t_1);
       if (unlikely(!__pyx_t_4)) {
@@ -20125,11 +19765,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_39_parse(PyObject *__pyx_self, PyObj
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_line = 0;
   PyObject *__pyx_v_stream = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("_parse (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__stream,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20144,15 +19785,18 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_39_parse(PyObject *__pyx_self, PyObj
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_parse", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("_parse", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20369,18 +20013,10 @@ static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_40generator(__pyx_GeneratorObject *_
   for (;;) {
     if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_5)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_5)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else {
       __pyx_t_2 = __pyx_t_6(__pyx_t_5);
       if (unlikely(!__pyx_t_2)) {
@@ -20429,7 +20065,8 @@ static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_40generator(__pyx_GeneratorObject *_
       __Pyx_GOTREF(__pyx_t_1);
       __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s___lines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -20517,7 +20154,6 @@ static PyObject *__pyx_gb_5pysam_4cvcf_3VCF_40generator(__pyx_GeneratorObject *_
   __pyx_L0:;
   __Pyx_XDECREF(__pyx_r);
   __pyx_generator->resume_label = -1;
-  __Pyx_Generator_clear((PyObject*)__pyx_generator);
   __Pyx_RefNannyFinishContext();
   return NULL;
 }
@@ -20530,6 +20166,7 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_42getsamples(PyObject *__pyx_self, P
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getsamples (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_41getsamples(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -20585,11 +20222,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_44setsamples = {__Pyx_NAMESTR("s
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_samples = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__samples,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setsamples (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__samples,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20603,10 +20241,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_44setsamples(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samples)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samples);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setsamples", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20680,6 +20320,7 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_46getheader(PyObject *__pyx_self, Py
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getheader (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_45getheader(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -20735,11 +20376,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_48setheader = {__Pyx_NAMESTR("se
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_48setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_header = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__header,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setheader (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__header,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20753,10 +20395,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_48setheader(PyObject *__pyx_self, Py
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setheader", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20830,6 +20474,7 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_50getinfo(PyObject *__pyx_self, PyOb
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getinfo (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_49getinfo(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -20885,11 +20530,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_52setinfo = {__Pyx_NAMESTR("seti
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_info = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__info,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setinfo (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__info,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -20903,10 +20549,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_52setinfo(PyObject *__pyx_self, PyOb
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__info)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__info);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setinfo", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -20980,6 +20628,7 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_54getformat(PyObject *__pyx_self, Py
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getformat (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_53getformat(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -21035,11 +20684,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_56setformat = {__Pyx_NAMESTR("se
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_56setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_format = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setformat (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21053,10 +20703,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_56setformat(PyObject *__pyx_self, Py
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setformat", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21130,6 +20782,7 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_58getfilter(PyObject *__pyx_self, Py
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("getfilter (wrapper)", 0);
+  __pyx_self = __pyx_self;
   __pyx_r = __pyx_pf_5pysam_4cvcf_3VCF_57getfilter(__pyx_self, ((PyObject *)__pyx_v_self));
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -21185,11 +20838,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_60setfilter = {__Pyx_NAMESTR("se
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_filter = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filter,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setfilter (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filter,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21203,10 +20857,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_60setfilter(PyObject *__pyx_self, Py
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filter)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filter);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setfilter", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21278,11 +20934,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_62setversion = {__Pyx_NAMESTR("s
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_62setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_version = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__version,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setversion (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__version,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21296,10 +20953,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_62setversion(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__version)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__version);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setversion", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21356,11 +21015,13 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_61setversion(CYTHON_UNUSED PyObject
  *         self._version = version
  * 
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_33, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_33, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_40, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_40, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_t_4 = __pyx_t_3;
@@ -21404,11 +21065,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_64setregions = {__Pyx_NAMESTR("s
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_64setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_regions = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__regions,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setregions (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__regions,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21422,10 +21084,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_64setregions(PyObject *__pyx_self, P
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regions)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regions);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setregions", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21498,11 +21162,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_66setreference = {__Pyx_NAMESTR(
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_66setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_ref = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__ref,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("setreference (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__ref,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21516,10 +21181,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_66setreference(PyObject *__pyx_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("setreference", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21591,11 +21258,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_68ignoreerror = {__Pyx_NAMESTR("
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_errorstring = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("ignoreerror (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21609,10 +21277,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_68ignoreerror(PyObject *__pyx_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("ignoreerror", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21778,11 +21448,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_70warnerror = {__Pyx_NAMESTR("wa
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_errorstring = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("warnerror (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21796,10 +21467,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_70warnerror(PyObject *__pyx_self, Py
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("warnerror", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -21966,11 +21639,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_72parse = {__Pyx_NAMESTR("parse"
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("parse (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -21984,10 +21658,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_72parse(PyObject *__pyx_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("parse", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22107,11 +21783,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObje
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
   PyObject *__pyx_v_datagenerator = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__datagenerator,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("write (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__datagenerator,0};
     PyObject* values[3] = {0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -22126,15 +21803,18 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_74write(PyObject *__pyx_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__datagenerator)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__datagenerator);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("write", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22247,18 +21927,10 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_73write(CYTHON_UNUSED PyObject *__py
   for (;;) {
     if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
       if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
     } else {
       __pyx_t_2 = __pyx_t_5(__pyx_t_1);
       if (unlikely(!__pyx_t_2)) {
@@ -22314,11 +21986,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_76writeheader = {__Pyx_NAMESTR("
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_76writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_stream = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("writeheader (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -22332,10 +22005,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_76writeheader(PyObject *__pyx_self,
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("writeheader", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22450,11 +22125,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self
   PyObject *__pyx_v_pos2 = 0;
   PyObject *__pyx_v_ref2 = 0;
   PyObject *__pyx_v_alt2 = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos1,&__pyx_n_s__ref1,&__pyx_n_s__alt1,&__pyx_n_s__pos2,&__pyx_n_s__ref2,&__pyx_n_s__alt2,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("compare_calls (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos1,&__pyx_n_s__ref1,&__pyx_n_s__alt1,&__pyx_n_s__pos2,&__pyx_n_s__ref2,&__pyx_n_s__alt2,0};
     PyObject* values[7] = {0,0,0,0,0,0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -22473,35 +22149,42 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_78compare_calls(PyObject *__pyx_self
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref1)) != 0)) kw_args--;
+        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref1);
+        if (likely(values[2])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt1)) != 0)) kw_args--;
+        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt1);
+        if (likely(values[3])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  4:
-        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos2)) != 0)) kw_args--;
+        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos2);
+        if (likely(values[4])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  5:
-        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref2)) != 0)) kw_args--;
+        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref2);
+        if (likely(values[5])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  6:
-        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt2)) != 0)) kw_args--;
+        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt2);
+        if (likely(values[6])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22576,7 +22259,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObje
  *         # from both calls, trim rightmost bases when identical.  Do this safely, i.e.
  *         # only when the reference bases are not Ns
  */
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos1, __pyx_v_pos2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos1, __pyx_v_pos2, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
@@ -22608,7 +22292,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObje
         __Pyx_GOTREF(__pyx_t_1);
         __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_alt1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_6);
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -22668,7 +22353,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObje
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_alt2, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
         __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -22718,7 +22404,8 @@ static PyObject *__pyx_pf_5pysam_4cvcf_3VCF_77compare_calls(CYTHON_UNUSED PyObje
  * ###########################################################################################################
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt1, __pyx_v_alt2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt1, __pyx_v_alt2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
   goto __pyx_L0;
@@ -22748,11 +22435,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_80connect = {__Pyx_NAMESTR("conn
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_80connect(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;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("connect (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -22766,10 +22454,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_80connect(PyObject *__pyx_self, PyOb
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("connect", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -22891,11 +22581,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObje
   PyObject *__pyx_v_start = 0;
   PyObject *__pyx_v_end = 0;
   PyObject *__pyx_v_region = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
     PyObject* values[5] = {0,0,0,0,0};
 
     /* "pysam/cvcf.pyx":1022
@@ -22948,7 +22639,8 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_82fetch(PyObject *__pyx_self, PyObje
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
         if (kw_args > 0) {
@@ -23096,11 +22788,12 @@ static PyMethodDef __pyx_mdef_5pysam_4cvcf_3VCF_84validate = {__Pyx_NAMESTR("val
 static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   CYTHON_UNUSED PyObject *__pyx_v_self = 0;
   CYTHON_UNUSED PyObject *__pyx_v_record = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__record,0};
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("validate (wrapper)", 0);
+  __pyx_self = __pyx_self;
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__record,0};
     PyObject* values[2] = {0,0};
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
@@ -23114,10 +22807,12 @@ static PyObject *__pyx_pw_5pysam_4cvcf_3VCF_84validate(PyObject *__pyx_self, PyO
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
+        if (likely(values[0])) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record)) != 0)) kw_args--;
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record);
+        if (likely(values[1])) kw_args--;
         else {
           __Pyx_RaiseArgtupleInvalid("validate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
@@ -23205,16 +22900,16 @@ static PyObject *__pyx_tp_new_5pysam_4cvcf_VCFRecord(PyTypeObject *t, PyObject *
 
 static void __pyx_tp_dealloc_5pysam_4cvcf_VCFRecord(PyObject *o) {
   struct __pyx_obj_5pysam_4cvcf_VCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_VCFRecord *)o;
-  PyObject_GC_UnTrack(o);
-  Py_CLEAR(p->vcf);
-  PyObject_GC_Track(o);
-  if (likely(__pyx_ptype_5pysam_10TabProxies_TupleProxy)) __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_5pysam_4cvcf_VCFRecord);
+  Py_XDECREF(p->vcf);
+  __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_dealloc(o);
 }
 
 static int __pyx_tp_traverse_5pysam_4cvcf_VCFRecord(PyObject *o, visitproc v, void *a) {
   int e;
   struct __pyx_obj_5pysam_4cvcf_VCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_VCFRecord *)o;
-  e = ((likely(__pyx_ptype_5pysam_10TabProxies_TupleProxy)) ? ((__pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_traverse) ? __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_4cvcf_VCFRecord)); if (e) return e;
+  if (__pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_traverse) {
+    e = __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_traverse(o, v, a); if (e) return e;
+  }
   if (p->vcf) {
     e = (*v)(p->vcf, a); if (e) return e;
   }
@@ -23224,7 +22919,9 @@ static int __pyx_tp_traverse_5pysam_4cvcf_VCFRecord(PyObject *o, visitproc v, vo
 static int __pyx_tp_clear_5pysam_4cvcf_VCFRecord(PyObject *o) {
   struct __pyx_obj_5pysam_4cvcf_VCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_VCFRecord *)o;
   PyObject* tmp;
-  if (likely(__pyx_ptype_5pysam_10TabProxies_TupleProxy)) { if (__pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_clear) __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5pysam_4cvcf_VCFRecord);
+  if (__pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_clear) {
+    __pyx_ptype_5pysam_10TabProxies_TupleProxy->tp_clear(o);
+  }
   tmp = ((PyObject*)p->vcf);
   p->vcf = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
@@ -23238,43 +22935,43 @@ static PyObject *__pyx_sq_item_5pysam_4cvcf_VCFRecord(PyObject *o, Py_ssize_t i)
   return r;
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_contig(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_contig(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_6contig_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_pos(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_pos(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_3pos_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_id(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_id(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_2id_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_ref(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_ref(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_3ref_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_alt(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_alt(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_3alt_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_qual(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_qual(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_4qual_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_filter(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_filter(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_6filter_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_info(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_info(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_4info_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_format(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_format(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_6format_1__get__(o);
 }
 
-static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_samples(PyObject *o, CYTHON_UNUSED void *x) {
+static PyObject *__pyx_getprop_5pysam_4cvcf_9VCFRecord_samples(PyObject *o, void *x) {
   return __pyx_pw_5pysam_4cvcf_9VCFRecord_7samples_1__get__(o);
 }
 
@@ -23462,16 +23159,16 @@ static PyObject *__pyx_tp_new_5pysam_4cvcf_asVCFRecord(PyTypeObject *t, PyObject
 
 static void __pyx_tp_dealloc_5pysam_4cvcf_asVCFRecord(PyObject *o) {
   struct __pyx_obj_5pysam_4cvcf_asVCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)o;
-  PyObject_GC_UnTrack(o);
-  Py_CLEAR(p->vcffile);
-  PyObject_GC_Track(o);
-  if (likely(__pyx_ptype_5pysam_6ctabix_Parser)) __pyx_ptype_5pysam_6ctabix_Parser->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_5pysam_4cvcf_asVCFRecord);
+  Py_XDECREF(p->vcffile);
+  __pyx_ptype_5pysam_6ctabix_Parser->tp_dealloc(o);
 }
 
 static int __pyx_tp_traverse_5pysam_4cvcf_asVCFRecord(PyObject *o, visitproc v, void *a) {
   int e;
   struct __pyx_obj_5pysam_4cvcf_asVCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)o;
-  e = ((likely(__pyx_ptype_5pysam_6ctabix_Parser)) ? ((__pyx_ptype_5pysam_6ctabix_Parser->tp_traverse) ? __pyx_ptype_5pysam_6ctabix_Parser->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_4cvcf_asVCFRecord)); if (e) return e;
+  if (__pyx_ptype_5pysam_6ctabix_Parser->tp_traverse) {
+    e = __pyx_ptype_5pysam_6ctabix_Parser->tp_traverse(o, v, a); if (e) return e;
+  }
   if (p->vcffile) {
     e = (*v)(p->vcffile, a); if (e) return e;
   }
@@ -23481,7 +23178,9 @@ static int __pyx_tp_traverse_5pysam_4cvcf_asVCFRecord(PyObject *o, visitproc v,
 static int __pyx_tp_clear_5pysam_4cvcf_asVCFRecord(PyObject *o) {
   struct __pyx_obj_5pysam_4cvcf_asVCFRecord *p = (struct __pyx_obj_5pysam_4cvcf_asVCFRecord *)o;
   PyObject* tmp;
-  if (likely(__pyx_ptype_5pysam_6ctabix_Parser)) { if (__pyx_ptype_5pysam_6ctabix_Parser->tp_clear) __pyx_ptype_5pysam_6ctabix_Parser->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5pysam_4cvcf_asVCFRecord);
+  if (__pyx_ptype_5pysam_6ctabix_Parser->tp_clear) {
+    __pyx_ptype_5pysam_6ctabix_Parser->tp_clear(o);
+  }
   tmp = ((PyObject*)p->vcffile);
   p->vcffile = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
@@ -23646,7 +23345,7 @@ static PyTypeObject __pyx_type_5pysam_4cvcf_asVCFRecord = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct__parse_data(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct__parse_data(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
@@ -23657,9 +23356,7 @@ static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct__parse_data(PyType
 
 static void __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct__parse_data(PyObject *o) {
   struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct__parse_data *)o;
-  PyObject_GC_UnTrack(o);
-  Py_CLEAR(p->__pyx_v_alt);
-  PyObject_GC_Track(o);
+  Py_XDECREF(p->__pyx_v_alt);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -23839,7 +23536,7 @@ static PyTypeObject __pyx_type_5pysam_4cvcf___pyx_scope_struct__parse_data = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
@@ -23852,11 +23549,9 @@ static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_1_genexpr(PyTypeOb
 
 static void __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct_1_genexpr(PyObject *o) {
   struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_1_genexpr *)o;
-  PyObject_GC_UnTrack(o);
-  Py_CLEAR(p->__pyx_outer_scope);
-  Py_CLEAR(p->__pyx_v_allele);
-  Py_CLEAR(p->__pyx_t_0);
-  PyObject_GC_Track(o);
+  Py_XDECREF(((PyObject *)p->__pyx_outer_scope));
+  Py_XDECREF(p->__pyx_v_allele);
+  Py_XDECREF(p->__pyx_t_0);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -24048,7 +23743,7 @@ static PyTypeObject __pyx_type_5pysam_4cvcf___pyx_scope_struct_1_genexpr = {
   #endif
 };
 
-static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_2__parse(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_2__parse(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *p;
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
@@ -24063,13 +23758,11 @@ static PyObject *__pyx_tp_new_5pysam_4cvcf___pyx_scope_struct_2__parse(PyTypeObj
 
 static void __pyx_tp_dealloc_5pysam_4cvcf___pyx_scope_struct_2__parse(PyObject *o) {
   struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *p = (struct __pyx_obj_5pysam_4cvcf___pyx_scope_struct_2__parse *)o;
-  PyObject_GC_UnTrack(o);
-  Py_CLEAR(p->__pyx_v_d);
-  Py_CLEAR(p->__pyx_v_line);
-  Py_CLEAR(p->__pyx_v_self);
-  Py_CLEAR(p->__pyx_v_stream);
-  Py_CLEAR(p->__pyx_t_1);
-  PyObject_GC_Track(o);
+  Py_XDECREF(p->__pyx_v_d);
+  Py_XDECREF(p->__pyx_v_line);
+  Py_XDECREF(p->__pyx_v_self);
+  Py_XDECREF(p->__pyx_v_stream);
+  Py_XDECREF(p->__pyx_t_1);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
@@ -26748,23 +26441,16 @@ PyMODINIT_FUNC PyInit_cvcf(void)
   #endif
   /*--- Module creation code ---*/
   #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cvcf"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cvcf"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
   #else
   __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, "pysam.cvcf")) {
-      if (unlikely(PyDict_SetItemString(modules, "pysam.cvcf", __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);
+  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  #if PY_MAJOR_VERSION < 3
+  Py_INCREF(__pyx_m);
   #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
+  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -27962,7 +27648,7 @@ static void __Pyx_RaiseArgtupleInvalid(
         more_or_less = "exactly";
     }
     PyErr_Format(PyExc_TypeError,
-                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                  func_name, more_or_less, num_expected,
                  (num_expected == 1) ? "" : "s", num_found);
 }
@@ -27976,7 +27662,7 @@ static void __Pyx_RaiseDoubleKeywordsError(
         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
         #else
         "%s() got multiple values for keyword argument '%s'", func_name,
-        PyString_AsString(kw_name));
+        PyString_AS_STRING(kw_name));
         #endif
 }
 
@@ -27997,72 +27683,48 @@ static int __Pyx_ParseOptionalKeywords(
         while (*name && (**name != key)) name++;
         if (*name) {
             values[name-argnames] = value;
-            continue;
-        }
-        name = first_kw_arg;
-        #if PY_MAJOR_VERSION < 3
-        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
-            while (*name) {
-                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
-                        && _PyString_Eq(**name, key)) {
-                    values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    if ((**argname == key) || (
-                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
-                             && _PyString_Eq(**argname, key))) {
-                        goto arg_passed_twice;
-                    }
-                    argname++;
+        } else {
+            #if PY_MAJOR_VERSION < 3
+            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
+            #else
+            if (unlikely(!PyUnicode_Check(key))) {
+            #endif
+                goto invalid_keyword_type;
+            } else {
+                for (name = first_kw_arg; *name; name++) {
+                    #if PY_MAJOR_VERSION >= 3
+                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                        PyUnicode_Compare(**name, key) == 0) break;
+                    #else
+                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                        _PyString_Eq(**name, key)) break;
+                    #endif
                 }
-            }
-        } else
-        #endif
-        if (likely(PyUnicode_Check(key))) {
-            while (*name) {
-                int cmp = (**name == key) ? 0 :
-                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
-                #endif
-                    PyUnicode_Compare(**name, key);
-                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                if (cmp == 0) {
+                if (*name) {
                     values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    int cmp = (**argname == key) ? 0 :
-                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
-                    #endif
-                        PyUnicode_Compare(**argname, key);
-                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                    if (cmp == 0) goto arg_passed_twice;
-                    argname++;
+                } else {
+                    for (name=argnames; name != first_kw_arg; name++) {
+                        if (**name == key) goto arg_passed_twice;
+                        #if PY_MAJOR_VERSION >= 3
+                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
+                        #else
+                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                            _PyString_Eq(**name, key)) goto arg_passed_twice;
+                        #endif
+                    }
+                    if (kwds2) {
+                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+                    } else {
+                        goto invalid_keyword;
+                    }
                 }
             }
-        } else
-            goto invalid_keyword_type;
-        if (kwds2) {
-            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
-        } else {
-            goto invalid_keyword;
         }
     }
     return 0;
 arg_passed_twice:
-    __Pyx_RaiseDoubleKeywordsError(function_name, key);
+    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
     goto bad;
 invalid_keyword_type:
     PyErr_Format(PyExc_TypeError,
@@ -28081,9 +27743,10 @@ bad:
     return -1;
 }
 
+
+
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
     PyObject *local_type, *local_value, *local_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
     PyThreadState *tstate = PyThreadState_GET();
     local_type = tstate->curexc_type;
@@ -28092,27 +27755,19 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     tstate->curexc_type = 0;
     tstate->curexc_value = 0;
     tstate->curexc_traceback = 0;
-#else
-    PyErr_Fetch(&local_type, &local_value, &local_tb);
-#endif
     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
-#if CYTHON_COMPILING_IN_CPYTHON
     if (unlikely(tstate->curexc_type))
-#else
-    if (unlikely(PyErr_Occurred()))
-#endif
         goto bad;
     #if PY_MAJOR_VERSION >= 3
     if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
         goto bad;
     #endif
-    Py_INCREF(local_type);
-    Py_INCREF(local_value);
-    Py_INCREF(local_tb);
     *type = local_type;
     *value = local_value;
     *tb = local_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
+    Py_INCREF(local_type);
+    Py_INCREF(local_value);
+    Py_INCREF(local_tb);
     tmp_type = tstate->exc_type;
     tmp_value = tstate->exc_value;
     tmp_tb = tstate->exc_traceback;
@@ -28120,13 +27775,10 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
     tstate->exc_value = local_value;
     tstate->exc_traceback = local_tb;
     /* Make sure tstate is in a consistent state when we XDECREF
-       these objects (DECREF may run arbitrary code). */
+       these objects (XDECREF may run arbitrary code). */
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
-#else
-    PyErr_SetExcInfo(local_type, local_value, local_tb);
-#endif
     return 0;
 bad:
     *type = 0;
@@ -28173,38 +27825,33 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                         CYTHON_UNUSED PyObject *cause) {
     Py_XINCREF(type);
-    if (!value || value == Py_None)
-        value = NULL;
-    else
+    Py_XINCREF(value);
+    Py_XINCREF(tb);
+    if (tb == Py_None) {
+        Py_DECREF(tb);
+        tb = 0;
+    }
+    else if (tb != NULL && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto raise_error;
+    }
+    if (value == NULL) {
+        value = Py_None;
         Py_INCREF(value);
-    if (!tb || tb == Py_None)
-        tb = NULL;
-    else {
-        Py_INCREF(tb);
-        if (!PyTraceBack_Check(tb)) {
-            PyErr_SetString(PyExc_TypeError,
-                "raise: arg 3 must be a traceback or None");
-            goto raise_error;
-        }
     }
     #if PY_VERSION_HEX < 0x02050000
-    if (PyClass_Check(type)) {
+    if (!PyClass_Check(type))
     #else
-    if (PyType_Check(type)) {
+    if (!PyType_Check(type))
     #endif
-#if CYTHON_COMPILING_IN_PYPY
-        if (!value) {
-            Py_INCREF(Py_None);
-            value = Py_None;
-        }
-#endif
-        PyErr_NormalizeException(&type, &value, &tb);
-    } else {
-        if (value) {
+    {
+        if (value != Py_None) {
             PyErr_SetString(PyExc_TypeError,
                 "instance exception may not have a separate value");
             goto raise_error;
         }
+        Py_DECREF(value);
         value = type;
         #if PY_VERSION_HEX < 0x02050000
             if (PyInstance_Check(type)) {
@@ -28237,7 +27884,6 @@ raise_error:
 }
 #else /* Python 3+ */
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
-    PyObject* owned_instance = NULL;
     if (tb == Py_None) {
         tb = 0;
     } else if (tb && !PyTraceBack_Check(tb)) {
@@ -28255,36 +27901,12 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
         value = type;
         type = (PyObject*) Py_TYPE(value);
-    } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
-        }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
-        }
-    } else {
+    } else if (!PyExceptionClass_Check(type)) {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
-    if (cause && cause != Py_None) {
+    if (cause) {
         PyObject *fixed_cause;
         if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
@@ -28301,6 +27923,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
                             "BaseException");
             goto bad;
         }
+        if (!value) {
+            value = PyObject_CallObject(type, NULL);
+        }
         PyException_SetCause(value, fixed_cause);
     }
     PyErr_SetObject(type, value);
@@ -28314,16 +27939,12 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         }
     }
 bad:
-    Py_XDECREF(owned_instance);
     return;
 }
 #endif
 
 static double __Pyx__PyObject_AsDouble(PyObject* obj) {
     PyObject* float_value;
-#if CYTHON_COMPILING_IN_PYPY
-    float_value = PyNumber_Float(obj);
-#else
     if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
         return PyFloat_AsDouble(obj);
     } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
@@ -28340,7 +27961,6 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
         PyTuple_SET_ITEM(args, 0, 0);
         Py_DECREF(args);
     }
-#endif
     if (likely(float_value)) {
         double value = PyFloat_AS_DOUBLE(float_value);
         Py_DECREF(float_value);
@@ -28350,53 +27970,23 @@ bad:
     return (double)-1;
 }
 
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
-    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
-}
-
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
-    PyErr_Format(PyExc_ValueError,
-                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
-}
-
-static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
-    PyErr_Format(PyExc_ValueError,
-                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
-                 index, (index == 1) ? "" : "s");
-}
-
-static CYTHON_INLINE int __Pyx_IterFinish(void) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyThreadState *tstate = PyThreadState_GET();
-    PyObject* exc_type = tstate->curexc_type;
-    if (unlikely(exc_type)) {
-        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
-            PyObject *exc_value, *exc_tb;
-            exc_value = tstate->curexc_value;
-            exc_tb = tstate->curexc_traceback;
-            tstate->curexc_type = 0;
-            tstate->curexc_value = 0;
-            tstate->curexc_traceback = 0;
-            Py_DECREF(exc_type);
-            Py_XDECREF(exc_value);
-            Py_XDECREF(exc_tb);
-            return 0;
-        } else {
-            return -1;
-        }
-    }
-    return 0;
-#else
-    if (unlikely(PyErr_Occurred())) {
-        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
-            PyErr_Clear();
-            return 0;
-        } else {
-            return -1;
-        }
-    }
-    return 0;
-#endif
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
+    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
+}
+
+static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
+}
+
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
+    PyErr_Format(PyExc_ValueError,
+                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
+                 index, (index == 1) ? "" : "s");
+}
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+    PyErr_Format(PyExc_ValueError,
+                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
 }
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
@@ -28404,8 +27994,13 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
         Py_DECREF(retval);
         __Pyx_RaiseTooManyValuesError(expected);
         return -1;
-    } else {
-        return __Pyx_IterFinish();
+    } else if (PyErr_Occurred()) {
+        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
+            PyErr_Clear();
+            return 0;
+        } else {
+            return -1;
+        }
     }
     return 0;
 }
@@ -28417,197 +28012,13 @@ static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b)
     return q;
 }
 
-static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
-}
-
-static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
-    if (t == Py_None) {
-      __Pyx_RaiseNoneNotIterableError();
-    } else if (PyTuple_GET_SIZE(t) < index) {
-      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
-    } else {
-      __Pyx_RaiseTooManyValuesError(index);
-    }
-}
-
-static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
-                                             int is_tuple, int has_known_size, int decref_tuple) {
-    Py_ssize_t index;
-    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
-    if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
-        iternextfunc iternext;
-        iter = PyObject_GetIter(tuple);
-        if (unlikely(!iter)) goto bad;
-        if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
-        iternext = Py_TYPE(iter)->tp_iternext;
-        value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
-        value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
-        if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
-        Py_DECREF(iter);
-    } else {
-        if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
-            __Pyx_UnpackTupleError(tuple, 2);
-            goto bad;
-        }
-#if CYTHON_COMPILING_IN_PYPY
-        value1 = PySequence_ITEM(tuple, 0);
-        if (unlikely(!value1)) goto bad;
-        value2 = PySequence_ITEM(tuple, 1);
-        if (unlikely(!value2)) goto bad;
-#else
-        value1 = PyTuple_GET_ITEM(tuple, 0);
-        value2 = PyTuple_GET_ITEM(tuple, 1);
-        Py_INCREF(value1);
-        Py_INCREF(value2);
-#endif
-        if (decref_tuple) { Py_DECREF(tuple); }
-    }
-    *pvalue1 = value1;
-    *pvalue2 = value2;
-    return 0;
-unpacking_failed:
-    if (!has_known_size && __Pyx_IterFinish() == 0)
-        __Pyx_RaiseNeedMoreValuesError(index);
-bad:
-    Py_XDECREF(iter);
-    Py_XDECREF(value1);
-    Py_XDECREF(value2);
-    if (decref_tuple) { Py_XDECREF(tuple); }
-    return -1;
-}
 
-static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
-                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
-    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
-    *p_source_is_dict = is_dict;
-#if !CYTHON_COMPILING_IN_PYPY
-    if (is_dict) {
-        *p_orig_length = PyDict_Size(iterable);
-        Py_INCREF(iterable);
-        return iterable;
-    }
-#endif
-    *p_orig_length = 0;
-    if (method_name) {
-        PyObject* iter;
-        iterable = PyObject_CallMethodObjArgs(iterable, method_name, NULL);
-        if (!iterable)
-            return NULL;
-#if !CYTHON_COMPILING_IN_PYPY
-        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
-            return iterable;
-#endif
-        iter = PyObject_GetIter(iterable);
-        Py_DECREF(iterable);
-        return iter;
-    }
-    return PyObject_GetIter(iterable);
-}
-static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t orig_length, Py_ssize_t* ppos,
-                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
-    PyObject* next_item;
-#if !CYTHON_COMPILING_IN_PYPY
-    if (source_is_dict) {
-        PyObject *key, *value;
-        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
-            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
-            return -1;
-        }
-        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
-            return 0;
-        }
-        if (pitem) {
-            PyObject* tuple = PyTuple_New(2);
-            if (unlikely(!tuple)) {
-                return -1;
-            }
-            Py_INCREF(key);
-            Py_INCREF(value);
-            PyTuple_SET_ITEM(tuple, 0, key);
-            PyTuple_SET_ITEM(tuple, 1, value);
-            *pitem = tuple;
-        } else {
-            if (pkey) {
-                Py_INCREF(key);
-                *pkey = key;
-            }
-            if (pvalue) {
-                Py_INCREF(value);
-                *pvalue = value;
-            }
-        }
-        return 1;
-    } else if (PyTuple_CheckExact(iter_obj)) {
-        Py_ssize_t pos = *ppos;
-        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
-        *ppos = pos + 1;
-        next_item = PyTuple_GET_ITEM(iter_obj, pos);
-        Py_INCREF(next_item);
-    } else if (PyList_CheckExact(iter_obj)) {
-        Py_ssize_t pos = *ppos;
-        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
-        *ppos = pos + 1;
-        next_item = PyList_GET_ITEM(iter_obj, pos);
-        Py_INCREF(next_item);
-    } else
-#endif
-    {
-        next_item = PyIter_Next(iter_obj);
-        if (unlikely(!next_item)) {
-            return __Pyx_IterFinish();
-        }
-    }
-    if (pitem) {
-        *pitem = next_item;
-    } else if (pkey && pvalue) {
-        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
-            return -1;
-    } else if (pkey) {
-        *pkey = next_item;
-    } else {
-        *pvalue = next_item;
-    }
-    return 1;
-}
 
 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
     PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
 }
 
-static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
-    PyTypeObject* type = Py_TYPE(obj);
-    while (type && type->tp_dealloc != current_tp_dealloc)
-        type = type->tp_base;
-    while (type && type->tp_dealloc == current_tp_dealloc)
-        type = type->tp_base;
-    if (type)
-        type->tp_dealloc(obj);
-}
-
-static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
-    PyTypeObject* type = Py_TYPE(obj);
-    while (type && type->tp_traverse != current_tp_traverse)
-        type = type->tp_base;
-    while (type && type->tp_traverse == current_tp_traverse)
-        type = type->tp_base;
-    if (type && type->tp_traverse)
-        return type->tp_traverse(obj, v, a);
-    return 0;
-}
-
-static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
-    PyTypeObject* type = Py_TYPE(obj);
-    while (type && type->tp_clear != current_tp_clear)
-        type = type->tp_base;
-    while (type && type->tp_clear == current_tp_clear)
-        type = type->tp_base;
-    if (type && type->tp_clear)
-        type->tp_clear(obj);
-}
-
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
     *type = tstate->exc_type;
     *value = tstate->exc_value;
@@ -28615,12 +28026,8 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value,
     Py_XINCREF(*type);
     Py_XINCREF(*value);
     Py_XINCREF(*tb);
-#else
-    PyErr_GetExcInfo(type, value, tb);
-#endif
 }
 static void __Pyx_ExceptionReset(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->exc_type;
@@ -28632,9 +28039,6 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
     Py_XDECREF(tmp_type);
     Py_XDECREF(tmp_value);
     Py_XDECREF(tmp_tb);
-#else
-    PyErr_SetExcInfo(type, value, tb);
-#endif
 }
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
@@ -28717,6 +28121,7 @@ static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) {
 
 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
     PyObject *metaclass;
+    /* Default metaclass */
 #if PY_MAJOR_VERSION < 3
     if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
         PyObject *base = PyTuple_GET_ITEM(bases, 0);
@@ -28746,6 +28151,7 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na
     PyObject *metaclass;
     if (PyDict_SetItemString(dict, "__module__", modname) < 0)
         return NULL;
+    /* Python2 __metaclass__ */
     metaclass = PyDict_GetItemString(dict, "__metaclass__");
     if (metaclass) {
         Py_INCREF(metaclass);
@@ -29037,56 +28443,6 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
                                PyString_AsString(func_name), (void *)op);
 #endif
 }
-#if CYTHON_COMPILING_IN_PYPY
-static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
-    PyCFunctionObject* f = (PyCFunctionObject*)func;
-    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
-    PyObject *self = PyCFunction_GET_SELF(func);
-    Py_ssize_t size;
-    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
-    case METH_VARARGS:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
-            return (*meth)(self, arg);
-        break;
-    case METH_VARARGS | METH_KEYWORDS:
-        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
-    case METH_NOARGS:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
-            size = PyTuple_GET_SIZE(arg);
-            if (size == 0)
-                return (*meth)(self, NULL);
-            PyErr_Format(PyExc_TypeError,
-                "%.200s() takes no arguments (%zd given)",
-                f->m_ml->ml_name, size);
-            return NULL;
-        }
-        break;
-    case METH_O:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
-            size = PyTuple_GET_SIZE(arg);
-            if (size == 1)
-                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
-            PyErr_Format(PyExc_TypeError,
-                "%.200s() takes exactly one argument (%zd given)",
-                f->m_ml->ml_name, size);
-            return NULL;
-        }
-        break;
-    default:
-        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
-                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
-                        "longer supported!");
-        return NULL;
-    }
-    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
-                 f->m_ml->ml_name);
-    return NULL;
-}
-#else
-static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
-	return PyCFunction_Call(func, arg, kw);
-}
-#endif
 static PyTypeObject __pyx_CyFunctionType_type = {
     PyVarObject_HEAD_INIT(0, 0)
     __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
@@ -29106,7 +28462,7 @@ static PyTypeObject __pyx_CyFunctionType_type = {
     0,                                  /*tp_as_sequence*/
     0,                                  /*tp_as_mapping*/
     0,                                  /*tp_hash*/
-    __Pyx_CyFunction_Call,              /*tp_call*/
+    __Pyx_PyCFunction_Call,             /*tp_call*/
     0,                                  /*tp_str*/
     0,                                  /*tp_getattro*/
     0,                                  /*tp_setattro*/
@@ -29142,16 +28498,15 @@ static PyTypeObject __pyx_CyFunctionType_type = {
     0,                                  /*tp_version_tag*/
 #endif
 };
-static int __Pyx_CyFunction_init(void) {
-#if !CYTHON_COMPILING_IN_PYPY
-    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
-#endif
+static int __Pyx_CyFunction_init(void)
+{
     if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
         return -1;
     __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
     return 0;
 }
-static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
+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)
@@ -29160,7 +28515,8 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t
     m->defaults_pyobjects = pyobjects;
     return m->defaults;
 }
-static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
+static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple)
+{
     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
     m->defaults_tuple = tuple;
     Py_INCREF(tuple);
@@ -29191,6 +28547,78 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
     }
 }
 
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
+    if (s1 == s2) {
+        return (equals == Py_EQ);
+    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
+        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
+            return (equals == Py_NE);
+        } else if (PyBytes_GET_SIZE(s1) == 1) {
+            if (equals == Py_EQ)
+                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
+            else
+                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
+        } else {
+            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
+            return (equals == Py_EQ) ? (result == 0) : (result != 0);
+        }
+    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
+        return (equals == Py_NE);
+    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
+        return (equals == Py_NE);
+    } else {
+        int result;
+        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+        if (!py_result)
+            return -1;
+        result = __Pyx_PyObject_IsTrue(py_result);
+        Py_DECREF(py_result);
+        return result;
+    }
+}
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
+    if (s1 == s2) {
+        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
+        } else {
+            int result = PyUnicode_Compare(s1, s2);
+            if ((result == -1) && unlikely(PyErr_Occurred()))
+                return -1;
+            return (equals == Py_EQ) ? (result == 0) : (result != 0);
+        }
+    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
+        return (equals == Py_NE);
+    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
+        return (equals == Py_NE);
+    } else {
+        int result;
+        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+        if (!py_result)
+            return -1;
+        result = __Pyx_PyObject_IsTrue(py_result);
+        Py_DECREF(py_result);
+        return result;
+    }
+}
+
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
     const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
@@ -29593,7 +29021,6 @@ 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;
-#if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
     tmp_type = tstate->exc_type;
     tmp_value = tstate->exc_value;
@@ -29601,10 +29028,6 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
     tstate->exc_type = *type;
     tstate->exc_value = *value;
     tstate->exc_traceback = *tb;
-#else
-    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
-    PyErr_SetExcInfo(*type, *value, *tb);
-#endif
     *type = tmp_type;
     *value = tmp_value;
     *tb = tmp_tb;
@@ -29614,70 +29037,9 @@ 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 PyTypeObject *__pyx_GeneratorType = 0;
-#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
-#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
-#if 1 || PY_VERSION_HEX < 0x030300B0
-static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
-    PyObject *et, *ev, *tb;
-    PyObject *value = NULL;
-    __Pyx_ErrFetch(&et, &ev, &tb);
-    if (!et) {
-        Py_XDECREF(tb);
-        Py_XDECREF(ev);
-        Py_INCREF(Py_None);
-        *pvalue = Py_None;
-        return 0;
-    }
-    if (unlikely(et != PyExc_StopIteration) &&
-            unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) {
-        __Pyx_ErrRestore(et, ev, tb);
-        return -1;
-    }
-    if (likely(et == PyExc_StopIteration)) {
-        if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) {
-            if (!ev) {
-                Py_INCREF(Py_None);
-                ev = Py_None;
-            }
-            Py_XDECREF(tb);
-            Py_DECREF(et);
-            *pvalue = ev;
-            return 0;
-        }
-    }
-    PyErr_NormalizeException(&et, &ev, &tb);
-    if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) {
-        __Pyx_ErrRestore(et, ev, tb);
-        return -1;
-    }
-    Py_XDECREF(tb);
-    Py_DECREF(et);
-#if PY_VERSION_HEX >= 0x030300A0
-    value = ((PyStopIterationObject *)ev)->value;
-    Py_INCREF(value);
-    Py_DECREF(ev);
-#else
-    {
-        PyObject* args = PyObject_GetAttrString(ev, "args");
-        Py_DECREF(ev);
-        if (likely(args)) {
-            value = PyObject_GetItem(args, 0);
-            Py_DECREF(args);
-        }
-        if (unlikely(!value)) {
-            __Pyx_ErrRestore(NULL, NULL, NULL);
-            Py_INCREF(Py_None);
-            value = Py_None;
-        }
-    }
-#endif
-    *pvalue = value;
-    return 0;
-}
-#endif
 static CYTHON_INLINE
-void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
+void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self)
+{
     PyObject *exc_type = self->exc_type;
     PyObject *exc_value = self->exc_value;
     PyObject *exc_traceback = self->exc_traceback;
@@ -29689,18 +29051,14 @@ void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
     Py_XDECREF(exc_traceback);
 }
 static CYTHON_INLINE
-int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) {
-    if (unlikely(gen->is_running)) {
+PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value)
+{
+    PyObject *retval;
+    if (unlikely(self->is_running)) {
         PyErr_SetString(PyExc_ValueError,
                         "generator already executing");
-        return 1;
+        return NULL;
     }
-    return 0;
-}
-static CYTHON_INLINE
-PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
-    PyObject *retval;
-    assert(!self->is_running);
     if (unlikely(self->resume_label == 0)) {
         if (unlikely(value && value != Py_None)) {
             PyErr_SetString(PyExc_TypeError,
@@ -29713,240 +29071,81 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
         PyErr_SetNone(PyExc_StopIteration);
         return NULL;
     }
-    if (value) {
-#if CYTHON_COMPILING_IN_PYPY
-#else
-        /* Generators always return to their most recent caller, not
-         * necessarily their creator. */
-        if (self->exc_traceback) {
-            PyThreadState *tstate = PyThreadState_GET();
-            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
-            PyFrameObject *f = tb->tb_frame;
-            Py_XINCREF(tstate->frame);
-            assert(f->f_back == NULL);
-            f->f_back = tstate->frame;
-        }
-#endif
-        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
-                            &self->exc_traceback);
-    } else {
+    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);
-#if CYTHON_COMPILING_IN_PYPY
-#else
-        /* Don't keep the reference to f_back any longer than necessary.  It
-         * may keep a chain of frames alive or it could create a reference
-         * cycle. */
-        if (self->exc_traceback) {
-            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
-            PyFrameObject *f = tb->tb_frame;
-            Py_CLEAR(f->f_back);
-        }
-#endif
-    } else {
+    if (retval)
+        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
+    else
         __Pyx_Generator_ExceptionClear(self);
-    }
     return retval;
 }
-static CYTHON_INLINE
-PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) {
-    PyObject *ret;
-    PyObject *val = NULL;
-    __Pyx_Generator_Undelegate(gen);
-    __Pyx_PyGen_FetchStopIterationValue(&val);
-    ret = __Pyx_Generator_SendEx(gen, val);
-    Py_XDECREF(val);
-    return ret;
-}
-static PyObject *__Pyx_Generator_Next(PyObject *self) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
-    PyObject *yf = gen->yieldfrom;
-    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
-        return NULL;
-    if (yf) {
-        PyObject *ret;
-        gen->is_running = 1;
-        ret = Py_TYPE(yf)->tp_iternext(yf);
-        gen->is_running = 0;
-        if (likely(ret)) {
-            return ret;
-        }
-        return __Pyx_Generator_FinishDelegation(gen);
-    }
-    return __Pyx_Generator_SendEx(gen, Py_None);
-}
-static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
-    PyObject *yf = gen->yieldfrom;
-    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
-        return NULL;
-    if (yf) {
-        PyObject *ret;
-        gen->is_running = 1;
-        if (__Pyx_Generator_CheckExact(yf)) {
-            ret = __Pyx_Generator_Send(yf, value);
-        } else {
-            if (value == Py_None)
-                ret = PyIter_Next(yf);
-            else
-                ret = PyObject_CallMethod(yf, (char*)"send", (char*)"O", value);
-        }
-        gen->is_running = 0;
-        if (likely(ret)) {
-            return ret;
-        }
-        return __Pyx_Generator_FinishDelegation(gen);
-    }
-    return __Pyx_Generator_SendEx(gen, value);
+static PyObject *__Pyx_Generator_Next(PyObject *self)
+{
+    return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, Py_None);
 }
-static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
-    PyObject *retval = NULL;
-    int err = 0;
-    if (__Pyx_Generator_CheckExact(yf)) {
-        retval = __Pyx_Generator_Close(yf);
-        if (!retval)
-            return -1;
-    } else {
-        PyObject *meth;
-        gen->is_running = 1;
-        meth = PyObject_GetAttrString(yf, "close");
-        if (unlikely(!meth)) {
-            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
-                PyErr_WriteUnraisable(yf);
-            }
-            PyErr_Clear();
-        } else {
-            retval = PyObject_CallFunction(meth, NULL);
-            Py_DECREF(meth);
-            if (!retval)
-                err = -1;
-        }
-        gen->is_running = 0;
-    }
-    Py_XDECREF(retval);
-    return err;
+static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value)
+{
+    return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, value);
 }
-static PyObject *__Pyx_Generator_Close(PyObject *self) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
-    PyObject *retval, *raised_exception;
-    PyObject *yf = gen->yieldfrom;
-    int err = 0;
-    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
-        return NULL;
-    if (yf) {
-        Py_INCREF(yf);
-        err = __Pyx_Generator_CloseIter(gen, yf);
-        __Pyx_Generator_Undelegate(gen);
-        Py_DECREF(yf);
-    }
-    if (err == 0)
+static PyObject *__Pyx_Generator_Close(PyObject *self)
+{
+    __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
+    PyObject *retval;
 #if PY_VERSION_HEX < 0x02050000
-        PyErr_SetNone(PyExc_StopIteration);
+    PyErr_SetNone(PyExc_StopIteration);
 #else
-        PyErr_SetNone(PyExc_GeneratorExit);
+    PyErr_SetNone(PyExc_GeneratorExit);
 #endif
-    retval = __Pyx_Generator_SendEx(gen, NULL);
+    retval = __Pyx_Generator_SendEx(generator, NULL);
     if (retval) {
         Py_DECREF(retval);
         PyErr_SetString(PyExc_RuntimeError,
                         "generator ignored GeneratorExit");
         return NULL;
     }
-    raised_exception = PyErr_Occurred();
-    if (!raised_exception
-        || raised_exception == PyExc_StopIteration
-#if PY_VERSION_HEX >= 0x02050000
-        || raised_exception == PyExc_GeneratorExit
-        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
+#if PY_VERSION_HEX < 0x02050000
+    if (PyErr_ExceptionMatches(PyExc_StopIteration))
+#else
+    if (PyErr_ExceptionMatches(PyExc_StopIteration)
+        || PyErr_ExceptionMatches(PyExc_GeneratorExit))
 #endif
-        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
     {
-        if (raised_exception) PyErr_Clear();      /* ignore these errors */
+        PyErr_Clear();          /* ignore these errors */
         Py_INCREF(Py_None);
         return Py_None;
     }
     return NULL;
 }
-static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
+static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args)
+{
+    __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
     PyObject *typ;
     PyObject *tb = NULL;
     PyObject *val = NULL;
-    PyObject *yf = gen->yieldfrom;
     if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
         return NULL;
-    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
-        return NULL;
-    if (yf) {
-        PyObject *ret;
-        Py_INCREF(yf);
-#if PY_VERSION_HEX >= 0x02050000
-        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
-            int err = __Pyx_Generator_CloseIter(gen, yf);
-            Py_DECREF(yf);
-            __Pyx_Generator_Undelegate(gen);
-            if (err < 0)
-                return __Pyx_Generator_SendEx(gen, NULL);
-            goto throw_here;
-        }
-#endif
-        gen->is_running = 1;
-        if (__Pyx_Generator_CheckExact(yf)) {
-            ret = __Pyx_Generator_Throw(yf, args);
-        } else {
-            PyObject *meth = PyObject_GetAttrString(yf, "throw");
-            if (unlikely(!meth)) {
-                Py_DECREF(yf);
-                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
-                    gen->is_running = 0;
-                    return NULL;
-                }
-                PyErr_Clear();
-                __Pyx_Generator_Undelegate(gen);
-                gen->is_running = 0;
-                goto throw_here;
-            }
-            ret = PyObject_CallObject(meth, args);
-            Py_DECREF(meth);
-        }
-        gen->is_running = 0;
-        Py_DECREF(yf);
-        if (!ret) {
-            ret = __Pyx_Generator_FinishDelegation(gen);
-        }
-        return ret;
-    }
-throw_here:
     __Pyx_Raise(typ, val, tb, NULL);
-    return __Pyx_Generator_SendEx(gen, NULL);
+    return __Pyx_Generator_SendEx(generator, NULL);
 }
-static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) {
+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->yieldfrom);
     Py_VISIT(gen->exc_type);
     Py_VISIT(gen->exc_value);
     Py_VISIT(gen->exc_traceback);
     return 0;
 }
-static int __Pyx_Generator_clear(PyObject *self) {
-    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
-    Py_CLEAR(gen->closure);
-    Py_CLEAR(gen->classobj);
-    Py_CLEAR(gen->yieldfrom);
-    Py_CLEAR(gen->exc_type);
-    Py_CLEAR(gen->exc_value);
-    Py_CLEAR(gen->exc_traceback);
-    return 0;
-}
-static void __Pyx_Generator_dealloc(PyObject *self) {
+static void
+__Pyx_Generator_dealloc(PyObject *self)
+{
     __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
     PyObject_GC_UnTrack(gen);
     if (gen->gi_weakreflist != NULL)
@@ -29958,10 +29157,16 @@ static void __Pyx_Generator_dealloc(PyObject *self) {
             return;                     /* resurrected.  :( */
     }
     PyObject_GC_UnTrack(self);
-    __Pyx_Generator_clear(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) {
+static void
+__Pyx_Generator_del(PyObject *self)
+{
     PyObject *res;
     PyObject *error_type, *error_value, *error_traceback;
     __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
@@ -29990,13 +29195,11 @@ static void __Pyx_Generator_del(PyObject *self) {
         _Py_NewReference(self);
         self->ob_refcnt = refcnt;
     }
-#if CYTHON_COMPILING_FOR_CPYTHON
     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;
-#endif
     /* 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
@@ -30004,17 +29207,13 @@ static void __Pyx_Generator_del(PyObject *self) {
      * undone.
      */
 #ifdef COUNT_ALLOCS
-    --Py_TYPE(self)->tp_frees;
-    --Py_TYPE(self)->tp_allocs;
+    --self->ob_type->tp_frees;
+    --self->ob_type->tp_allocs;
 #endif
 }
 static PyMemberDef __pyx_Generator_memberlist[] = {
     {(char *) "gi_running",
-#if PY_VERSION_HEX >= 0x02060000
-     T_BOOL,
-#else
-     T_BYTE,
-#endif
+     T_INT,
      offsetof(__pyx_GeneratorObject, is_running),
      READONLY,
      NULL},
@@ -30026,7 +29225,7 @@ static PyMethodDef __pyx_Generator_methods[] = {
     {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
     {0, 0, 0, 0}
 };
-static PyTypeObject __pyx_GeneratorType_type = {
+static PyTypeObject __pyx_GeneratorType = {
     PyVarObject_HEAD_INIT(0, 0)
     __Pyx_NAMESTR("generator"),         /*tp_name*/
     sizeof(__pyx_GeneratorObject),      /*tp_basicsize*/
@@ -30047,7 +29246,7 @@ static PyTypeObject __pyx_GeneratorType_type = {
     0,                                  /*tp_hash*/
     0,                                  /*tp_call*/
     0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
+    PyObject_GenericGetAttr,            /*tp_getattro*/
     0,                                  /*tp_setattro*/
     0,                                  /*tp_as_buffer*/
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
@@ -30056,7 +29255,7 @@ static PyTypeObject __pyx_GeneratorType_type = {
     0,                                  /*tp_clear*/
     0,                                  /*tp_richcompare*/
     offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
-    0,                                  /*tp_iter*/
+    PyObject_SelfIter,                  /*tp_iter*/
     (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
     __pyx_Generator_methods,            /*tp_methods*/
     __pyx_Generator_memberlist,         /*tp_members*/
@@ -30081,10 +29280,12 @@ static PyTypeObject __pyx_GeneratorType_type = {
     0,                                  /*tp_version_tag*/
 #endif
 };
-static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
-                                                  PyObject *closure) {
+static
+__pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
+                                           PyObject *closure)
+{
     __pyx_GeneratorObject *gen =
-        PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
+        PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType);
     if (gen == NULL)
         return NULL;
     gen->body = body;
@@ -30093,7 +29294,6 @@ static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
     gen->is_running = 0;
     gen->resume_label = 0;
     gen->classobj = NULL;
-    gen->yieldfrom = NULL;
     gen->exc_type = NULL;
     gen->exc_value = NULL;
     gen->exc_traceback = NULL;
@@ -30101,14 +29301,9 @@ static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
     PyObject_GC_Track(gen);
     return gen;
 }
-static int __pyx_Generator_init(void) {
-    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
-    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
-    if (PyType_Ready(&__pyx_GeneratorType_type)) {
-        return -1;
-    }
-    __pyx_GeneratorType = &__pyx_GeneratorType_type;
-    return 0;
+static int __pyx_Generator_init(void)
+{
+    return PyType_Ready(&__pyx_GeneratorType);
 }
 
 static int __Pyx_check_binary_version(void) {
@@ -30130,23 +29325,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-#ifndef __PYX_HAVE_RT_ImportModule
-#define __PYX_HAVE_RT_ImportModule
-static PyObject *__Pyx_ImportModule(const char *name) {
-    PyObject *py_name = 0;
-    PyObject *py_module = 0;
-    py_name = __Pyx_PyIdentifier_FromString(name);
-    if (!py_name)
-        goto bad;
-    py_module = PyImport_Import(py_name);
-    Py_DECREF(py_name);
-    return py_module;
-bad:
-    Py_XDECREF(py_name);
-    return 0;
-}
-#endif
-
 #ifndef __PYX_HAVE_RT_ImportType
 #define __PYX_HAVE_RT_ImportType
 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
@@ -30199,6 +29377,23 @@ bad:
 }
 #endif
 
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+    PyObject *py_name = 0;
+    PyObject *py_module = 0;
+    py_name = __Pyx_PyIdentifier_FromString(name);
+    if (!py_name)
+        goto bad;
+    py_module = PyImport_Import(py_name);
+    Py_DECREF(py_name);
+    return py_module;
+bad:
+    Py_XDECREF(py_name);
+    return 0;
+}
+#endif
+
 static void* __Pyx_GetVtable(PyObject *dict) {
     void* ptr;
     PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
diff --git a/pysam/include/__init__.py b/pysam/include/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pysam/version.py b/pysam/version.py
index eb98027..22b95fa 100644
--- a/pysam/version.py
+++ b/pysam/version.py
@@ -1,6 +1,6 @@
 # pysam versioning information
 
-__version__ = "0.7.3"
+__version__ = "0.7.4"
 
 __samtools_version__ = "0.1.18"
 
diff --git a/samtools/__init__.py b/samtools/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/samtools/bcftools/__init__.py b/samtools/bcftools/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/samtools/win32/__init__.py b/samtools/win32/__init__.py
new file mode 100644
index 0000000..e69de29
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 182c30f..0cc9c4b 100644
--- a/setup.py
+++ b/setup.py
@@ -137,7 +137,7 @@ except ImportError:
     cmdclass = { }
     csamtools_sources = [ "pysam/csamtools.c" ]
     tabix_sources = [ "pysam/ctabix.c" ]
-    tabproxies_sourcess = ["pysam/TabProxies.c" ]
+    tabproxies_sources = ["pysam/TabProxies.c" ]
     cvcf_sources = ["pysam/cvcf.c" ]
 else:
     cmdclass = { 'build_ext' : build_ext }
@@ -228,11 +228,19 @@ metadata = {
     'license': "MIT",
     'platforms': "ALL",
     'url': "http://code.google.com/p/pysam/",
-    'packages' : find_packages(),
+    'packages' : ['pysam',
+                  'pysam.include',
+                  'pysam.include.samtools',
+                  'pysam.include.samtools.bcftools',
+                  'pysam.include.samtools.win32',
+                  'pysam.include.tabix'],
     'requires' : ['cython (>=0.17)'],
     'ext_modules': [samtools, tabix, tabproxies, cvcf ],
     'cmdclass' : cmdclass,
     'install_requires' : ['cython>=0.17',], 
+    'package_dir' : { 'pysam'                  : 'pysam',
+                      'pysam.include.samtools' : 'samtools',
+                      'pysam.include.tabix'    : 'tabix' },
     'package_data' : { '' : ['*.pxd', '*.h'],  },
     # do not pack in order to permit linking to csamtools.so
     'zip_safe' :False,
diff --git a/tabix/__init__.py b/tabix/__init__.py
new file mode 100644
index 0000000..e69de29

-- 
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