added DbStructure and organized code