cleaned up dimension code
setMatrixDim method and add method