Move totalThreads JSON generation to thread route