Move getting frequency data into func