added delay in R code