new database, email function corrected