Update to lastest SDK
Rewrite thread handling
Rewrite pause/resume handling
Cleanups