Messages refactor