# Autoloading MaTeX and Rubi via DeclarePackage[] in the user init.m does not work

I am using MaTeX, and I found the updateMaTeX[] function] at the GitHub repo. I tried to add this to my init.m in the MaTeX  context, and wrote

BeginPackage["MaTeX"];
updateMaTeX[] :=
Check[
json = Import["https://api.github.com/repos/szhorvat/MaTeX/releases/latest", "JSON"];
If[$Notebooks, PrintTemporary@Labeled[ProgressIndicator[Appearance -> "Necklace"], "Downloading...", Right], Print["Downloading..."] ]; URLSave[download, target], Return[$Failed]
]; If[FileExistsQ[target], PacletManagerPacletInstall[target], $Failed] ]; updateMaTeX::usage = "suggested at the MaTeX GitHub repo." EndPackage[]; DeclarePackage["MaTeX", {"MaTeX", "ConfigureMaTeX", "ClearMaTeXCache","updateMaTeX"}];  However this leads to two issues: 1. (Solved) The supposedly local variables jsondownloadtarget are touched in the MaTeX  context, and picked up by the auto-completion. It's a simple fix to add Remove[json, download, target] to the code, but I wonder why no $ModuleNumber was appended to the symbols.
2. Autoloading does not work as expected. Type MaTeX in a new notebook and it is still undefined; evaluation causes this new symbol to be created in Global . Typing MaTeXMaTeX, it is undefined, but become defined as soon as it is evaluated; GlobalMaTeX is simultaneously shadowed. At this point, the $$\text{M}\!^\text{A}\!\text{T}\!_{\normalsize{\text{E}}}\!\text{X}$$ document is accessible, but the symbol MaTeX(MaTeXMaTeX) does not have any downvalues, and thus is not working.
Similar issues occur with the Rubi  package. Therefore I wonder:
1. Is using BeginPackage["Package"] outside the package .m a good practice?
2. Why DeclarePackage` does not work as expected?