refactoring and attempt to fix leafdata non deletion issue