Usage statistics for v2.

Fix the DB initialization.
Add command line switches to define input and output dir.
Separate templates from formatted files.