updated database functions