Moved the MsgDB declaration a few lines up to keep it visually close to the thread arg declaration