Moved some logic from solver to stiff_matrix, where it belongs