R code fully implemented and commented - minor update