initial R code only