Add substitute utility.

Taken from Nova tools.