Added database function - incomplete