changed mainwindow to dialogs and added in database queries