Multithreading v2

Now we check if the filter thread is finished before starting a new one
of the same type. This is most likely prudent given the crazy behaviour
of the threads.