tweaks to new afd algorithm