Changed code to allow communication with multiple nodes