edits to rlib.cpp