Update communication.cpp

Adding magic function to make life easier