change frequency data structure from list to set