updated for database