Tweaks to renaming function