renamed R variable as RR to avoid collision