improve communication code architecture