Added a separate function for filling the r Coefficient