tightened up db stuff