added some print statements to see R commands executiing