refactoring detail dialog.