Cleaned and organized code for communication