updated the db read function