refactoring messages controller