added untested database code