Fixed bugs in Frequency header and added a lot of tests (that found the
bugs)
Restructured and cleaned up Count.