updated db code