A fault code read will give us a clue but not necessarily a solution as it is most likely to be a lambda sensor code due to the poor running but equally you could get a coolant temp sender fault code which would explain the poor idle stability.