adopt new tensor XML representation
cleanup and documentation