                 break;
 
             case cigar_event::I:
-                ctx.baq.qualities[qual_idx] = batch.qualities[qual_idx];
+                if (update_qualities)
+                {
+                    ctx.baq.qualities[qual_idx] = batch.qualities[qual_idx];
+                }
+
                 readI++;
                 current_op_offset = 0;
                 break;

                break;

            case cigar_event::M:
                const uint32 expectedPos = refI - refOffset + (i - numD - baq_start - readI);
                ctx.baq.qualities[qual_idx] = capBaseByBAQ(batch.qualities[idx.qual_start + read_bp_idx],
                                                           ctx.baq.qualities[idx.qual_start + read_bp_idx],
                                                           baq_state[idx.qual_start + read_bp_idx],
                                                           expectedPos);
                readI++;
                refI++;
                current_op_offset++;

                break;
            }
        }
    }
};

        return b;
    }

    template <bool update_qualities>
    CUDA_HOST_DEVICE bool cap_baq (const uint32 read_index,
                                   const CRQ_index idx,
                                   const uint32 cigar_start,
                                   const uint32 cigar_end,
                                   const uint32 baq_start,
                                   const ushort2 read_window_clipped,
                                   const uint2 hmm_reference_window)
    {
        uint32 readI = 0;
        uint32 refI = 0;
        uint32 current_op_offset = 0;
        uint32 numD = 0;
        const uint32 refOffset = hmm_reference_window.x;

        for(uint32 i = baq_start; i < cigar_end - cigar_start; i++)
        {
            const uint16 read_bp_idx = ctx.cigar.cigar_event_read_coordinates[cigar_start + i];
            const uint32 qual_idx = idx.qual_start + read_bp_idx;
