Modified 'convertListTo2dArray' more generic