Needed to move a reference from max_idx_val to peak_idx