            positions plp1))))
 
 (defn- read-alignments
-  [rdr ^String rname ^Long rlength ^Long pos]
-  (let [^Long left (let [^Long val (- pos window-width)]
-                     (if (< val 0)
-                       0
-                       val))
-        ^Long right (let [^Long val (+ pos window-width)]
-                      (if (< rlength val)
-                        rlength
-                        val))]
+  [rdr rname rlength pos]
+  (let [left (let [val (- pos window-width)]
+               (if (< val 0)
+                 0
+                 val))
+        right (let [val (+ pos window-width)]
+                (if (< rlength val)
+                  rlength
+                  val))]
     (io/read-alignments rdr {:chr rname
                              :start left
                              :end right

           refs)))

(defn- pileup*
  ([rdr ^FASTAReader fa-rdr ^String rname ^Long rlength ^Long start ^Long end]
     (flatten
      (let [parts (partition-all step (rpositions start end))]
        (map (fn [positions]
               (let [^Long pos (if (= (count positions) step)
                                 (nth positions center)
                                 (nth positions (quot (count positions) 2)))
                     ^clojure.lang.LazySeq alns (read-alignments rdr rname rlength pos)
                     ref-line (read-ref-fasta-line fa-rdr rname)]
                 (count-for-positions alns ref-line rname positions)))
             parts)))))

(defn pileup
  ([rdr ^String rname]
     (pileup rdr rname -1 -1))
  ([rdr ^String rname ^Long start* ^Long end* & {:keys [ref-fasta] :or {ref-fasta nil}}]
     (let [r (search-ref (.refs rdr) rname)]
       (if (nil? r)
         nil

(defrecord ^:private PileupStatus [count seq qual])

(defn- count-for-alignment
  [aln rname positions]
  (if (= rname (:rname aln))
    (let [left  (:pos aln)
          right (dec (+ left (cgr/count-ref (:cigar aln))))
