allow opts.format to be passed in