beginning of implementing frequency measurement