Changed structure of database and dialog related classes