Finished adapting the R script to the conditional constraints fix