Added diagonal matrices (need to test on an OCR system)