Added debug argument, selections saving, show/hide by click on legend label.