Refactored + resolved potential race condition during thread initialization