Improvement in code of to_matrix