Reworking classes, and CLI

Revised class structure for greater flexibility.  Added command line
interface.