refactored edit dialog