functionalizing file outputs and vector iterations