Refactoring communication functions