Working on multi-dimensional arrays