adding the output data frame for 1-4, and a change in the script