updated math so that it calcs frequency not period