Revert "Refs #5533 try threads with fitting moved inside function"

This reverts commit 787a9cba192bf1e8c386ebfdd73ade3c8102ff04.