fixed rmin bug, reduced code run time slightly