message database and thread handlers