Added averaging of category totals.

Cleaned up debugging, added defaults.