Added functions for database operations.