More fixes, and auto-determine format if not specified (rather than assume a default format).