choose db flag and dialog
fixes after review
refactor
Merge branch 'db_choose'