[Misc] Better refactoring using LocalDocumentReference