added working database code