refactoring dialogue_manager