add while loop to wait for message