Added database access and transaction building
Conflict resolved