added comments for sending and receiving to make it more readable