restructre db class