tex writeup changes + updated R code