updated database.cpp