Updates to R and py scripts