clean up of db code