Refactor, moves workerthread main to solver