Remove test code from main matrix_factor