added arguments for optionally outputting pdf and naming it