Added db functions WIP