Solution 2: solve the residual problems