depth refactoring messages controller