Added my version for spanning trees