Updated to take greater advantage of foad.py's new features.