refactor of messages