I think I've finally sussed it all out. When I collected the bike from the previous owner we had to reset the clock as he had removed the battery at some point. He did tell me why but I cant remember. Anyway, disconnecting the battery causes the ECU to lose its TPS settings, so it basically had to re-learn them as I didn't do the reset TPS procedure.
Further to this it turns out the bike had a faulty IACV (Idle actuator Control Valve). In case anyone wants to see a working IACV in situ and working I took a video of it inside the airbox. Not great quality as I had to stick a led torch in the airbox for lighting and my video camera is only a Lumix camera.
You can see it travels downwards when you put the ignition on. When you switch the ignition off it rises and then lowers to its starting point.
As I said the first one is the original one and is actually faulty. If you listen you can hear it struggle slightly and the movement slows down. Its subtle but its enough to make the bike stall on occasion and generally run rough at lower revs.
This is a replacement one. You can hear the motor noise is constant and the movement is constant too. Not much in it to look at but its a world of difference on the bike. Its smoother and picks up better at lower revs and of course doesn't stall!