Moved inversion of D,Q in A_solve