db functionality