Rcpp package from CRAN modified to work with TERR