Constructor cleanup. Fixed a memory leak in deallocating referenced matrices.