Updated threading model to stop spawning too many threads