Continued Implementation of RI model. Algorithm is completed, but it does not seem to be working right. Neet to investigate the correctness of results (might be bad parameters).