Remove duplicates from history