Replaced inefficient print_r(...)-based recursion detection by only printing arrays one level deep