Added db functionality