function [newWaves,newt,tinterval,baseMean,baseRMS,badWaves,reducedTime] = ReduceRange(oldWaves,tvect,timerange,tcenter,zeroORmax,CFThresh,reducedRangeWidth)

    
    tinterval=tvect(5,1)-tvect(4,1);
    lowT=tvect(1,1);

    icenter=int32((tcenter-lowT)/tinterval);

    halfrange=timerange/2;
    nsteps=int32(halfrange/tinterval);

    [dm1,s1w] = size(oldWaves(:,:,1));


    badWaves = [];
    p = 1;
    
    % Preallocating things for SPEED!
    newWaves = zeros( reducedRangeWidth,s1w,4 );
    baseMean = zeros( 4 , s1w );
    baseRMS = zeros( 4 , s1w );
    preThresh = reducedRangeWidth / 4;
    postThresh = reducedRangeWidth - preThresh - 1;
    
    reducedTime = 0:tinterval:((reducedRangeWidth-1)*tinterval);
    
    for i = 1:s1w
        baseMean(1,i)= sum(oldWaves(1:100,i,1))/100.;
        baseMean(2,i)= sum(oldWaves(1:100,i,2))/100.;
        baseMean(3,i)= sum(oldWaves(1:100,i,3))/100.;
        baseMean(4,i)= sum(oldWaves(1:100,i,4))/100.;
    
        baseMeanSq(1,1)= sum(oldWaves(1:100,i,1).*oldWaves(1:100,i,1))/100.;
        baseMeanSq(2,1)= sum(oldWaves(1:100,i,2).*oldWaves(1:100,i,2))/100.;
        baseMeanSq(3,1)= sum(oldWaves(1:100,i,3).*oldWaves(1:100,i,3))/100.;
        baseMeanSq(4,1)= sum(oldWaves(1:100,i,4).*oldWaves(1:100,i,4))/100.;
    
        baseRMS(1,i) = sqrt( baseMeanSq(1,1) - baseMean(1,i)*baseMean(1,i) );
        baseRMS(2,i) = sqrt( baseMeanSq(2,1) - baseMean(2,i)*baseMean(2,i) );
        baseRMS(3,i) = sqrt( baseMeanSq(3,1) - baseMean(3,i)*baseMean(3,i) );
        baseRMS(4,i) = sqrt( baseMeanSq(4,1) - baseMean(4,i)*baseMean(4,i) );
    
        if( zeroORmax == 1 )
            % Align waves about CF threshold of Ch 2
            [ Vmax , dm1 ] = max( oldWaves(:,i,2) );
            
            oneWaveThresh = CFThresh * Vmax;
            threshIndex = FirstThresh( oldWaves(:,i,2) , oneWaveThresh );
            
            %Note that in this method below we expect gaps to form in
            %newWaves when waves fall into badWaves.  This will be
            %corrected later with the locationOfGaps vector
            if( (threshIndex - 100) > 0 )
                newWaves(:,i,1) = oldWaves( (threshIndex-preThresh):(threshIndex+postThresh) ,i,1 );
                newWaves(:,i,2) = oldWaves( (threshIndex-preThresh):(threshIndex+postThresh) ,i,2 );
                newWaves(:,i,3) = oldWaves( (threshIndex-preThresh):(threshIndex+postThresh) ,i,3 );
                newWaves(:,i,4) = oldWaves( (threshIndex-preThresh):(threshIndex+postThresh) ,i,4 );
            else 
                badWaves(:,p,1)=oldWaves(:,i,1);
                badWaves(:,p,2)=oldWaves(:,i,2);
                badWaves(:,p,3)=oldWaves(:,i,3);
                badWaves(:,p,4)=oldWaves(:,i,4);
                p = p + 1;
            end
            
            
        elseif( zeroORmax == 0 )
            LRange = icenter - preThresh;
            HRange = icenter + postThresh;
            newWaves(:,i,1)=oldWaves(LRange:HRange,i,1);
            newWaves(:,i,2)=oldWaves(LRange:HRange,i,2);
            newWaves(:,i,3)=oldWaves(LRange:HRange,i,3);
            newWaves(:,i,4)=oldWaves(LRange:HRange,i,4);
        end
    end
    if(zeroORmax==1)
        newt=tvect;
    
    
    elseif(zeroORmax==0)
    
            newt = tvect((icenter - nsteps + 1):(icenter + nsteps));
    end
    if( zeroORmax == 1 )
        locationOfGaps = ( max ( newWaves(:,:,1) ) == 0 );
        newWaves = newWaves(:,logical(~locationOfGaps),:); 
        baseMean = baseMean(:,logical(~locationOfGaps));
        baseRMS = baseRMS(:,logical(~locationOfGaps));
    end
    
end