variable "r" is no longer global.