Not sure if anyone has addressed this, but does Data have command responsibilities when Picard/Riker are on the ship and on-duty or does his "second officer hat" so to speak, only get used when those two are not on-board/on-duty?
I saw where he had the authority to confine a crewman to quarters or to order security take someone into custody--and this was when Picard and Riker on duty.
As with the visiting officers, I noticed that Cmder Shelby had the same rank as Data, but she was giving Data orders even though he's the ship second officer.
Shelby wore the red uniform that kind of suggested she had automatic authority or something.