version 2 (correct) of R script added