Implemented better subtensor extractor