unplug your MAF, even though it's new, see if it smooths out after that.
also check your vac lines and in particular something called the main sucking jet. when i was working on my water pump / radiator hoses i knocked this bad bay around and it caused some trouble. i just put it all back to together and everything was fine. don't remember the codes, maybe i posted about it, but it definitely ran like crap without the peddle floored.
part #1
RealOEM.com BMW E53 X5 4.4i Vacuum control - engine
the top popped off it (whats pictured to the right, that comes apart). i lined it up properly, snapped it back into place, used a little glue/sealant and used a zip tie to hold it together.