Some refactoring for treating tables and arrays in the same way