You may also want to read the documentation on rename and type renameable setting. When renaming the beforerename and onrename callbacks are triggered.