Added raw and smooth frequency calculation