updated db functions