Cleaned rename function