ported from private repo.
ported from private repo.