Refactored dialogs and contacts manager.