made into r package