Refactored and added in the proper information for the algorithm to work accroding to the paper.