variable "r" is no longer global.
Merge pull request #7 from PascalPflaum/master

variable "r" is no longer global.