added detect_array method