Refactor messaging