Added database functionality