AP detection added