Got Database functions working