move db stuff to a module
fetch threads