Refactor + Bug Fix; No frontend change
Refactor + Bug Fix; No frontend change

Refactored some parts, fixed a problem with what used to be "take_next" which could result in accessing an empty list.
nbsdx/ThreadPool