3 R algorithms implemented. Now we need generalization and refactoring.