Added functions from wfgen.