modified r snippet