Copied from tweedledum.