Added line to save output, before and after subsetting
modified for test data
modified for test data