gist = (Gist)gists.get(i);
if(gist.getDescription().toUpperCase().contains(serialNumber.toUpperCase())){ //found the last matching gist. toUpperCase is because Windows capitalizes the letters I hope this isn't a problem!
if(foundMatchingGist==true){ //if one has already been found then an extra was made in error and needs to be cleaned up
//delete the spurious gist
service.deleteGist(gist.getId());
}else if(gist.isPublic()==!makePrivate){// rewrite the gist if there is already one and the privacy settings are the same
for (String key : gist.getFiles().keySet()) {// "delete" old ones, if this wasn't here every time you saved a sketch with a new name it would not overwrite the old sketch
boolean matchingFile=false;
for(int j =0; j<theSketches.length; j++){
if((theSketches[j].getPrettyName()+"."+theSketches[j].getExtension()).contains(gist.getFiles().get(key).getFilename())){