Fix for Matrix Class

Had trouble getting VS to recognise the new class, so just copy-pasted
the code.