refactored a lot, set up dialogs