Fix archiving and output file selection
Archiving for now only takes the first archive definition. This needs to be moved into config.