Updated for R programming