able to send and receive data. Need to clean up code