Added new stages. Considerable changes to the serialization to allow for a more proper separation of tree and standalone objects.