Added auto r function - update