changed function declarations to r_ format