added print statement to save out the diagonal elements of R