AF refactored