I'm a bit confused about how Baran died. I get that Picard switched the codes so that when Baran tried to activate Picard's implant and kill him, it activated Baran's implant instead. But... why the hell does Baran have an implant?

Plotline

Data must deal with a First Officer who may not be up to the job while trying to defeat the mercenaries and rescue Riker and the still-alive Picard.