Implement function renaming to allow nested definitions