Altered the R file to implement the two desired methods