Refactor thread list handling

Currently there is only one thread list where all possible thread are stored.
But the code to retrieve them by type is complicated and not really readable.
There must be one thread list per thread type and also one thread global list for