use db wrapper to replace old code