Reduce calls to is_array