added some frequency checking