Keep only different values in the History & Clean JS