Fix wrong include path.
Move simple functions into inline.
Add idle thread functionality.