get back deleted upgrade feature. Refactor decoder to take multiple trees in the same file