Updated template R scripts