adding in the figuring out of the filename for the output