finished the naming of the output files and added some function comments