Support for multi-dimensional sequences

Modified serialization module to support multi-dimensional sequences.