Added a little bit of db functionality