edit rr function