Add a caching iterator over tags
Move threads to own module
Move out threads and messages