optimized online detection