save and load as tree