minor refactor for AP mode