changed functs to create output file and add to it, more changes coming