Manage recursion in arrays