cleanup of TR functions.R code related to #32