porting QC to clojure #339