replaced table script with improved .rmd file