added serialization and deserialization of a tree