Restructured comms code