Small tweak - you should escape the label like we do the url with a strreplace in case there is a quote in the label itself (unlikely but possible and it would break the csv output).