Add support for reading in configuration from a config file and also setting it from the command line. Fix some bugs in the previous refactoring. Use namedtuple for nicer indexing.