modified runanalysis.R