fixes
refactored dialog code