frequency calculation now working.