Added databse functionality