Changed how the threading works

The thread can be restarted again once it has been paused.