small changes to r-code