// adapted from http://stackoverflow.com/a/13486540
function dedupe(str, delimiter) {
    return str.split(delimiter || ',').reverse().filter(function(e, i, arr) {
        return arr.indexOf(e, i+1) === -1;
    }).reverse();
}