CHANGED TO R PACKAGE VERSION