Final Version for R operations