Pulled changes from Trieng (Array2d class)