Add support for multidimensional arrays

This addresses issues #29 and #104.