re-factor and create msg object