added code for communication and serialization