Optimized find function