refactor messages