Added R2 function and panic tests.