Merges with latest Cost Control

Take in count I've rebased your version over latest Gaia but changes are only inside Cost Control so I recommend you not accept the *this PR* but merge from my commit only Cost Control, then update your performance PR.

It's up to you.