r4r sample code