apex detection added