Deductions & credits

The CREDIT is used first to lower the tax bill.   Then if you have any tax liability left over the  withholdings are applied and the excess  refunded.   If you simply read the form 1040 line by line you will see how this happens.