Make r into a namespace and other tweaks to the minidriver