updates to R code