                     (- (:end wig) (:start wig)))))
           (serialize [wigs]
             (lazy-seq
-             (when (some? (first wigs))
-               (let [[track rest-wigs] (split-with (partial same-track?
-                                                            (first wigs))
+             (when-first [wig wigs]
+               (let [[track rest-wigs] (split-with (partial same-track? wig)
                                                    wigs)
                      track (case (-> track first :format)
                              :variable-step

  [lines]
  (letfn [(deserialize [lines pre-start current-track]
            (lazy-seq
             (when (some? (first lines))
               (let [fields (-> lines first cstr/trim (cstr/split #"\s+"))]
                 (case (first fields)
                   ; declaration line of variableStep
                   "variableStep"


                             :fixed-step
                             (let [{:keys [chr start end]} (first track)
                                   step (- (-> track second :start) start)
                                   span (inc (- end start))
                                   declaration-line (->> (cond-> ["fixedStep"
                                                                  (str "chrom=" chr)
