Changed pseudo-code to real sending and receiving