function [veinfo] = saveVerts(name,newverts1,newverts2,tends)
persistent vertices, persistent ends
try,
	veinfo = [];
	veinfo = vertices;
    
    	switch name,
    		
    		case {'returnverts'},
    			% just return current vertices
    			return;
    		case {'returnends'},
		    	% return current trackline ends
		    	veinfo = ends;
		    	return;
    		case {'init'},
    			vertices = [];
    			ends = [];
			veinfo = vertices;
    		case {'save'},
			% save new set of verts
			if isempty(vertices), 
				vertices(:,:,1) = [newverts1,newverts2];
				ends(1,:) = tends;
			else
				vertices(:,:,size(vertices,3)+1) = [newverts1,newverts2];
				veinfo = vertices;
				ends(size(ends,1)+1,:) = tends;
			end
		case {'size'},
			% return size of vertices
			veinfo = size(vertices,3);
		
	end
catch, errorbox('saveVerts'),
end
