Change more of the IPC code to take connections by reference