refactor message manager.
add missing message manager factory.