Code for R2V2