Significant changes to classes.py to deal with larger databases. Changes
also helped clarify api (to me at least) and reduce redundant code.  Sets
stage for implementation of FreqLogger in future change.