Implementation of IN & OUT. TODO: Sending and receiving messages