Warning: spoilers follow for the Wheel of Time series, including the last few books!
We know that Demandred recruited Mazrim Taim for the Shadow, but when exactly did this happen in Rand's timeline? In The Dragon Reborn it is revealed that the runaway Black Ajah Aes Sedai have a plan to free Mazrim. So was he converted even before he met Rand? If yes, why did he come to help Rand at the Dumai's Wells? Was it to plant his own men with Rand? Did Dashiva (Osan'gar, Aginor previously) persuade Taim to help Rand so he can later become Rand's personal Asha'man, or was it Demandred who sent Taim to Dumai's Wells because he didn't want Rand to be captured by the Shaido? Or is it possible that Taim was still not on the Shadow's side and he was there just because he cared about Rand's protection for the Black Tower?