added db functionality