forked for AF 2.0