corrected function paramters (r)