Added ability to divide by scalar and invert matrix