adding recursive inline replacement funtion called rir