Functions and database