modified R code: improved names of input variables; modified internal variable schema to omit dots and underscores