Ported from old repo.