Added command line interface.  Some minor clean-up