function [waves,flattops] = rmFlattops(waves,VM)

tooHigh = .97*max(VM(:,2));

bads = VM(:,2) > tooHigh;

flattops = waves(:,logical(bads),:);
waves = waves(:,~logical(bads),:);
end