branched out the communication-related functions to comm.c