- Removed unused code, and unneeded macro
- Restore thread control function