use db instead of file