Moved rename into function