cleaned up knitr code