adding a seperate thread to read the messages