Rewrote Matrix class (simpler, more effective)
Modified for new Matrix class