Improve frequency normalization and unit tests.