refined version

I believe it should work now.  doing c++ of db