Added threading to receive msgs