updated send and recieve functions