Added safe printing of matrices
Polished printing