handle incoming messages with inbuilt thread