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.
It would also capture function to only access its private list and keep things contained