Some Fixes for datalog storing multidimensional data

Corrected padding multidimensional arrays with zeros to match
required lengths.  Renamed some variables to make more readable