Had to create some temporaries to fixed a shifting problem in the addmatrix method.