Remove the throttlebody and spray some throttlebody cleaner in it and wipe down with a rag. Watch out for the maf.
And the idle air valve can be cleaned the same way but do mark it and make sure it goes back on the same position
p0171 is a bad maf 9/10 times. The post cat one will never trigger a p0171 as they are only used for checking if the cat works or not.
The coilpack engines use a few different op2 sensors so check the connector if you want to replace them.
Depends if you have nats or not. If you have then you cant just replace the ecu. You might be able to swap the gearbox ecu but it wouldnt be something id suspect to be bad.