function [data] = Read_TIDSoR(fid,num_wfs,coh_avgs,recs_2_load,rec_start,start_cut,cut_length,rec_length,data_start)
    %------------------------------------------%
    % Read Accum Radar data                    %
    %------------------------------------------%
    % Authors:  John Ledford
    %           William Blake
    % Edited:   Cameron Lewis

    % System parameters, hand coded for now
%     num_wfs     = 1;
%     data_fn = './data_0404a/data00.04042009.0003.dat';
%     coh_avgs    = 4;
%     recs_2_load = 10000; % 0 for all, or # desired
%     rec_start   = 1;

%     fid = fopen(data_fn,'r','ieee-be');
% 
%     % Rewind the file to the beginning
%     fseek(fid,0,'bof');
% 
%     % Find first header section
%     i=0;
%     while true
%         tmp = fread(fid,1,'uint32');
%         if tmp == hex2dec('deadbeef');
%             fseek(fid,-4,'cof');
%             break;
%         end
%         fseek(fid,-3,'cof');
%     end
% 
%     %Read first Header & Print to screen
%     fprintf('\nFirst Record Set:\n')
%     fprintf('-----------------\n')
%     magiccode  = fread(fid, 1, 'uint32');
%     fprintf('Magic Code: %x\n',magiccode)
%     header_ver = fread(fid, 1, 'uint8');
%     fprintf('Header Version: %d\n',header_ver)
%     header_cnt = fread(fid,1,'ubit24');
%     fprintf('Header Count: %d\n',header_cnt)
%     epritime1  = fread(fid, 1, 'uint64');
%     fprintf('EPRI Time: %bx\n',epritime1)
%     tmp        = fread(fid,3,'uint32');
%     UTC_hr     = tmp(1);
%     UTC_min    = tmp(2);
%     UTC_sec    = tmp(3);
%     fprintf('UTC Time: %02.f:%02.f:%02.f\n',UTC_hr,UTC_min,UTC_sec);
%     fseek(fid,-28,'cof');
%     data_start = ftell(fid);
%     fseek(fid,data_start+28,'bof');
% 
%     % Get record length
%     rec_byte_len = 0;
%     while true
%         tmp = fread(fid,1,'uint32');
%         if tmp == hex2dec('deadbeef');
%             fseek(fid,-4,'cof');
%             break;
%         end
%         fseek(fid,-3,'cof');
%         rec_byte_len = rec_byte_len+1;
%     end
%     % Remove the 4 byte checksum at the end
%     rec_byte_len = rec_byte_len - 4;
%     % Assumed uint16 (2 byte values)
%     rec_length = rec_byte_len/2;
%     fprintf('Record Length: %.0f\n',rec_length);
% 
    num_recs = recs_2_load;
%     fprintf('Number of Records to Load: %.0f\n',num_recs);

    fseek(fid,data_start+rec_start*(28+num_wfs*rec_length*2+4),'bof');
    data = zeros(rec_length-cut_length-start_cut,floor(num_recs/coh_avgs),'single');
    header_ver = zeros(1,num_recs);
    header_cnt = zeros(1,num_recs);
    epritime1  = zeros(1,num_recs);
    UTC_hr     = zeros(1,num_recs);
    UTC_min    = zeros(1,num_recs);
    UTC_sec    = zeros(1,num_recs);
    for i0 = 1:floor(num_recs/coh_avgs)
        tmp_data = zeros(rec_length,1,'single');
        for i1 = 1:coh_avgs
            idx = (i0-1)*coh_avgs+i1;
            magiccode  = fread(fid,1,'uint32');
            if (magiccode ~= hex2dec('deadbeef'))
                warning('Magic Code incorrect at record: %.0f',idx);
                last_header_cnt = header_cnt(idx-1);
                while magiccode ~= hex2dec('deadbeef')
                    fseek(fid,-3,'cof');
                    magiccode = fread(fid,1,'uint32');
                end
                header_ver(idx) = fread(fid,1,'uint8');
                header_cnt(idx) = fread(fid,1,'ubit24');
                epritime1(idx)  = fread(fid,1,'uint64');
                tmp             = fread(fid,3,'uint32');
                UTC_hr(idx)     = tmp(1);
                UTC_min(idx)    = tmp(2);
                UTC_sec(idx)    = tmp(3);
                warning('%.0f Records Lost',header_cnt(idx)-header_cnt(idx-1));
            else
                header_ver(idx) = fread(fid,1,'uint8');
                header_cnt(idx) = fread(fid,1,'ubit24');
                epritime1(idx)  = fread(fid,1,'uint64');
                tmp             = fread(fid,3,'uint32');
                UTC_hr(idx)     = tmp(1);
                UTC_min(idx)    = tmp(2);
                UTC_sec(idx)    = tmp(3);
            end
            tmp_raw = fread(fid,rec_length,'uint16=>float32');
            tmp_data(1:2:end) = tmp_data(1:2:end)+tmp_raw(2:2:end)/coh_avgs;
            tmp_data(2:2:end) = tmp_data(2:2:end)+tmp_raw(1:2:end)/coh_avgs;
            filecrc1 = fread(fid, 1, 'uint32');
        end
        % Remove last "cut_length" points because there is junk spike there
        data(:,i0) = (tmp_data(1+start_cut:end-cut_length)-mean(tmp_data)).*blackman(length(tmp_data)-start_cut-cut_length);
    end
    data = data - repmat(mean(data,2),1,size(data,2));
%     fclose(fid);
%     fprintf('\nLast Record Set:\n')
%     fprintf('-----------------\n')
%     fprintf('Magic Code: %x\n',magiccode(end))
%     fprintf('Header Version: %d\n',header_ver(end))
%     fprintf('Header Count: %d\n',header_cnt(end))
%     fprintf('EPRI Time: %bx\n',epritime1(end))
%     fprintf('UTC Time: %02.f:%02.f:%02.f\n',UTC_hr(end),UTC_min(end),UTC_sec(end));

%     f_samp = 120E6;
%     taxis = linspace(0,size(data,1)/f_samp,size(data,1));
%     faxis = linspace(0,f_samp,size(data,1));
%     figure(1);
%     subplot(2,1,1);
%         plot(taxis*1E6,data(:,1));
%         xlabel('Time [us]');
%     subplot(2,1,2);
%         plot(faxis/1E6,20*log10(abs(fft(data(:,1)))));
%         axis([0 55 0 150]);
%         xlabel('Beat Frequency [MHz]');